From f84fdfee9fcbaa3c52bb0a31522ce02a63a5210d Mon Sep 17 00:00:00 2001 From: Joe Hoyle Date: Fri, 1 Dec 2023 12:49:19 +0100 Subject: [PATCH 1/3] Try tests with Cstring --- src/zend/_type.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/zend/_type.rs b/src/zend/_type.rs index dc2ba4783..cf6116c1e 100644 --- a/src/zend/_type.rs +++ b/src/zend/_type.rs @@ -1,4 +1,4 @@ -use std::{ffi::c_void, ptr}; +use std::{ffi::{c_void, CString}, ptr}; use crate::{ ffi::{ @@ -80,7 +80,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 From e7974309b496011d53f09bc65529a4e7089980ed Mon Sep 17 00:00:00 2001 From: Joe Hoyle Date: Fri, 1 Dec 2023 12:52:46 +0100 Subject: [PATCH 2/3] fmt --- src/zend/_type.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/zend/_type.rs b/src/zend/_type.rs index cf6116c1e..5e2aaff8f 100644 --- a/src/zend/_type.rs +++ b/src/zend/_type.rs @@ -1,4 +1,7 @@ -use std::{ffi::{c_void, CString}, ptr}; +use std::{ + ffi::{c_void, CString}, + ptr, +}; use crate::{ ffi::{ From 7068a03e9139bf4b4fa79c99b596d408e1921bb6 Mon Sep 17 00:00:00 2001 From: Joe Hoyle Date: Fri, 1 Dec 2023 12:56:58 +0100 Subject: [PATCH 3/3] Remove unused type --- src/zend/_type.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/zend/_type.rs b/src/zend/_type.rs index 5e2aaff8f..4342e3fcf 100644 --- a/src/zend/_type.rs +++ b/src/zend/_type.rs @@ -9,7 +9,6 @@ use crate::{ _ZEND_SEND_MODE_SHIFT, _ZEND_TYPE_NAME_BIT, _ZEND_TYPE_NULLABLE_BIT, }, flags::DataType, - types::ZendStr, }; /// Internal Zend type.