From: Dmitry Stogov Date: Thu, 4 Aug 2005 08:46:53 +0000 (+0000) Subject: Fixed clone bug in ze1_compatibility mode X-Git-Tag: php-5.0.5RC1~26 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=42d4af122b4e79929185a2c18ee5d948d7af4cbc;p=php Fixed clone bug in ze1_compatibility mode --- diff --git a/Zend/zend_objects.c b/Zend/zend_objects.c index dde4fddf89..baa920226f 100644 --- a/Zend/zend_objects.c +++ b/Zend/zend_objects.c @@ -113,7 +113,7 @@ ZEND_API zend_object *zend_objects_get_address(zval *zobject TSRMLS_DC) static void zval_add_ref_or_clone(zval **p) { - if (Z_TYPE_PP(p) == IS_OBJECT) { + if (Z_TYPE_PP(p) == IS_OBJECT && !PZVAL_IS_REF(*p)) { TSRMLS_FETCH(); if (Z_OBJ_HANDLER_PP(p, clone_obj) == NULL) { @@ -124,7 +124,7 @@ static void zval_add_ref_or_clone(zval **p) ALLOC_ZVAL(*p); **p = *orig; INIT_PZVAL(*p); - (*p)->value.obj = Z_OBJ_HT_PP(p)->clone_obj(*p TSRMLS_CC); + (*p)->value.obj = Z_OBJ_HT_PP(p)->clone_obj(orig TSRMLS_CC); } } else { (*p)->refcount++;