File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -41,8 +41,18 @@ impl ZendObject {
41
41
// SAFETY: Using emalloc to allocate memory inside Zend arena. Casting `ce` to
42
42
// `*mut` is valid as the function will not mutate `ce`.
43
43
unsafe {
44
- let ptr = zend_objects_new ( ce as * const _ as * mut _ ) ;
45
- object_properties_init ( ptr, ce as * const _ as * mut _ ) ;
44
+ let ptr = match ce. __bindgen_anon_2 . create_object {
45
+ None => {
46
+ let ptr = zend_objects_new ( ce as * const _ as * mut _ ) ;
47
+ if ptr. is_null ( ) {
48
+ panic ! ( "Failed to allocate memory for Zend object" )
49
+ }
50
+ object_properties_init ( ptr, ce as * const _ as * mut _ ) ;
51
+ ptr
52
+ } ,
53
+ Some ( v) => v ( ce as * const _ as * mut _ )
54
+ } ;
55
+
46
56
ZBox :: from_raw (
47
57
ptr. as_mut ( )
48
58
. expect ( "Failed to allocate memory for Zend object" ) ,
You can’t perform that action at this time.
0 commit comments