Skip to content

Commit

Permalink
Merge pull request #301 from davidcole1340/revert-ctr-test
Browse files Browse the repository at this point in the history
Try tests with Cstring
  • Loading branch information
danog committed Dec 7, 2023
2 parents cb2afe9 + 7068a03 commit 3dcce49
Showing 1 changed file with 5 additions and 3 deletions.
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

0 comments on commit 3dcce49

Please sign in to comment.