Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions src/zend/_type.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
use std::{ffi::c_void, ptr};
use std::{
ffi::{c_void, CString},
ptr,
};

use crate::{
ffi::{
zend_type, IS_MIXED, MAY_BE_ANY, MAY_BE_BOOL, _IS_BOOL, _ZEND_IS_VARIADIC_BIT,
_ZEND_SEND_MODE_SHIFT, _ZEND_TYPE_NAME_BIT, _ZEND_TYPE_NULLABLE_BIT,
},
flags::DataType,
types::ZendStr,
};

/// Internal Zend type.
Expand Down Expand Up @@ -80,7 +82,7 @@ impl ZendType {
allow_null: bool,
) -> Option<Self> {
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
Expand Down