diff --git a/src/zend/_type.rs b/src/zend/_type.rs index dc2ba47830..4342e3fcf4 100644 --- a/src/zend/_type.rs +++ b/src/zend/_type.rs @@ -1,4 +1,7 @@ -use std::{ffi::c_void, ptr}; +use std::{ + ffi::{c_void, CString}, + ptr, +}; use crate::{ ffi::{ @@ -6,7 +9,6 @@ use crate::{ _ZEND_SEND_MODE_SHIFT, _ZEND_TYPE_NAME_BIT, _ZEND_TYPE_NULLABLE_BIT, }, flags::DataType, - types::ZendStr, }; /// Internal Zend type. @@ -80,7 +82,7 @@ impl ZendType { allow_null: bool, ) -> Option { Some(Self { - ptr: ZendStr::new(class_name, true).into_raw().as_ptr() as *mut c_void, + ptr: CString::new(class_name).ok()?.into_raw() as *mut c_void, type_mask: _ZEND_TYPE_NAME_BIT | (if allow_null { _ZEND_TYPE_NULLABLE_BIT