From: Dmitry Stogov Date: Tue, 29 Jul 2014 10:34:43 +0000 (+0400) Subject: Fixed Zend/tests/bug54265.phpt X-Git-Tag: POST_PHPNG_MERGE~44^2~4 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=cad6408a3f1999090c08c811c2508d9d15c2670f;p=php Fixed Zend/tests/bug54265.phpt --- diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c index 7fca796137..282781a9ab 100644 --- a/Zend/zend_execute.c +++ b/Zend/zend_execute.c @@ -697,34 +697,23 @@ static inline void zend_assign_to_object(zval *retval, zval *object_ptr, zval *p if (Z_TYPE_P(object) == IS_NULL || Z_TYPE_P(object) == IS_FALSE || (Z_TYPE_P(object) == IS_STRING && Z_STRLEN_P(object) == 0)) { -//??? The following block may handle only non-interned empty string, -//??? but it doesn't work anyway -//??? see: Zend/tests/bug54265.phpt -#if 0 - if (Z_REFCOUNTED_P(object)) { - if (!Z_ISREF_P(object_ptr)) { - SEPARATE_ZVAL(object); - } - Z_ADDREF_P(object); - zend_error(E_WARNING, "Creating default object from empty value"); - if (Z_REFCOUNT_P(object) == 1) { - /* object was removed by error handler, nothing to assign to */ - zval_ptr_dtor(object); - if (retval) { - ZVAL_NULL(retval); - } - FREE_OP(free_value); - return; + zend_object *obj; + + zval_ptr_dtor(object); + object_init(object); + Z_ADDREF_P(object); + obj = Z_OBJ_P(object); + zend_error(E_WARNING, "Creating default object from empty value"); + if (GC_REFCOUNT(obj) == 1) { + /* the enclosing container was deleted, obj is unreferenced */ + if (retval) { + ZVAL_NULL(retval); } - Z_DELREF_P(object); - } else { - zend_error(E_WARNING, "Creating default object from empty value"); + FREE_OP(free_value); + OBJ_RELEASE(obj); + return; } -#else - zend_error(E_WARNING, "Creating default object from empty value"); -#endif - zval_dtor(object); - object_init(object); + Z_DELREF_P(object); } else { zend_error(E_WARNING, "Attempt to assign property of non-object"); if (retval) {