@@ -122,8 +122,8 @@ ZEND_API zend_object_handle zend_objects_store_put(void *object, zend_objects_st
122
122
obj -> object = object ;
123
123
obj -> dtor = dtor ?dtor :(zend_objects_store_dtor_t )zend_objects_destroy_object ;
124
124
obj -> free_storage = free_storage ;
125
-
126
125
obj -> clone = clone ;
126
+ obj -> handlers = NULL ;
127
127
128
128
#if ZEND_DEBUG_OBJECTS
129
129
fprintf (stderr , "Allocated object id #%d\n" , handle );
@@ -168,7 +168,7 @@ ZEND_API void zend_objects_store_del_ref(zval *zobject TSRMLS_DC)
168
168
handle = Z_OBJ_HANDLE_P (zobject );
169
169
170
170
Z_ADDREF_P (zobject );
171
- zend_objects_store_del_ref_by_handle (handle TSRMLS_CC );
171
+ zend_objects_store_del_ref_by_handle_ex (handle , Z_OBJ_HT_P ( zobject ) TSRMLS_CC );
172
172
Z_DELREF_P (zobject );
173
173
174
174
GC_ZOBJ_CHECK_POSSIBLE_ROOT (zobject );
@@ -177,7 +177,7 @@ ZEND_API void zend_objects_store_del_ref(zval *zobject TSRMLS_DC)
177
177
/*
178
178
* Delete a reference to an objects store entry given the object handle.
179
179
*/
180
- ZEND_API void zend_objects_store_del_ref_by_handle (zend_object_handle handle TSRMLS_DC )
180
+ ZEND_API void zend_objects_store_del_ref_by_handle_ex (zend_object_handle handle , const zend_object_handlers * handlers TSRMLS_DC ) /* {{{ */
181
181
{
182
182
struct _store_object * obj ;
183
183
int failure = 0 ;
@@ -198,6 +198,9 @@ ZEND_API void zend_objects_store_del_ref_by_handle(zend_object_handle handle TSR
198
198
EG (objects_store ).object_buckets [handle ].destructor_called = 1 ;
199
199
200
200
if (obj -> dtor ) {
201
+ if (handlers && !obj -> handlers ) {
202
+ obj -> handlers = handlers ;
203
+ }
201
204
zend_try {
202
205
obj -> dtor (obj -> object , handle TSRMLS_CC );
203
206
} zend_catch {
@@ -232,6 +235,7 @@ ZEND_API void zend_objects_store_del_ref_by_handle(zend_object_handle handle TSR
232
235
zend_bailout ();
233
236
}
234
237
}
238
+ /* }}} */
235
239
236
240
ZEND_API zend_object_value zend_objects_store_clone_obj (zval * zobject TSRMLS_DC )
237
241
{
@@ -250,6 +254,7 @@ ZEND_API zend_object_value zend_objects_store_clone_obj(zval *zobject TSRMLS_DC)
250
254
251
255
retval .handle = zend_objects_store_put (new_object , obj -> dtor , obj -> free_storage , obj -> clone TSRMLS_CC );
252
256
retval .handlers = Z_OBJ_HT_P (zobject );
257
+ EG (objects_store ).object_buckets [handle ].bucket .obj .handlers = retval .handlers ;
253
258
254
259
return retval ;
255
260
}
@@ -288,8 +293,10 @@ ZEND_API void zend_object_store_set_object(zval *zobject, void *object TSRMLS_DC
288
293
ZEND_API void zend_object_store_ctor_failed (zval * zobject TSRMLS_DC )
289
294
{
290
295
zend_object_handle handle = Z_OBJ_HANDLE_P (zobject );
291
-
292
- EG (objects_store ).object_buckets [handle ].destructor_called = 1 ;
296
+ zend_object_store_bucket * obj_bucket = & EG (objects_store ).object_buckets [handle ];
297
+
298
+ obj_bucket -> bucket .obj .handlers = Z_OBJ_HT_P (zobject );;
299
+ obj_bucket -> destructor_called = 1 ;
293
300
}
294
301
295
302
0 commit comments