Skip to content

Commit 8b7bd62

Browse files
committed
fixup! Zend: Implement the default clone_with as clone + manual property adjustments
1 parent c0184a4 commit 8b7bd62

File tree

1 file changed

+0
-7
lines changed

1 file changed

+0
-7
lines changed

Zend/zend_objects.c

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,6 @@ ZEND_API void ZEND_FASTCALL zend_objects_clone_members(zend_object *new_object,
264264
}
265265

266266
if (has_clone_method) {
267-
GC_ADDREF(new_object);
268267
zend_call_known_instance_method_with_0_params(new_object->ce->clone, new_object, NULL);
269268

270269
if (ZEND_CLASS_HAS_READONLY_PROPS(new_object->ce)) {
@@ -274,8 +273,6 @@ ZEND_API void ZEND_FASTCALL zend_objects_clone_members(zend_object *new_object,
274273
Z_PROP_FLAG_P(prop) &= ~IS_PROP_REINITABLE;
275274
}
276275
}
277-
278-
OBJ_RELEASE(new_object);
279276
}
280277
}
281278

@@ -284,8 +281,6 @@ ZEND_API zend_object *zend_objects_clone_obj_with(zend_object *old_object, const
284281
zend_object *new_object = old_object->handlers->clone_obj(old_object);
285282

286283
if (EXPECTED(!EG(exception)) && zend_hash_num_elements(properties) > 0) {
287-
GC_ADDREF(new_object);
288-
289284
/* Unlock readonly properties once more. */
290285
if (ZEND_CLASS_HAS_READONLY_PROPS(new_object->ce)) {
291286
for (uint32_t i = 0; i < new_object->ce->default_properties_count; i++) {
@@ -316,8 +311,6 @@ ZEND_API zend_object *zend_objects_clone_obj_with(zend_object *old_object, const
316311
} ZEND_HASH_FOREACH_END();
317312

318313
EG(fake_scope) = old_scope;
319-
320-
OBJ_RELEASE(new_object);
321314
}
322315

323316
return new_object;

0 commit comments

Comments
 (0)