]> granicus.if.org Git - php/commitdiff
Fixed clone bug in ze1_compatibility mode
authorDmitry Stogov <dmitry@php.net>
Thu, 4 Aug 2005 08:46:53 +0000 (08:46 +0000)
committerDmitry Stogov <dmitry@php.net>
Thu, 4 Aug 2005 08:46:53 +0000 (08:46 +0000)
Zend/zend_objects.c

index dde4fddf89c4eb430dacbefe6f431d85811d34f8..baa920226fd90c96be41dd20e2a2242d20a72a92 100644 (file)
@@ -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++;