diff options
author | Xinchen Hui <laruence@php.net> | 2014-07-30 10:47:03 +0800 |
---|---|---|
committer | Xinchen Hui <laruence@php.net> | 2014-07-30 10:47:03 +0800 |
commit | 2147799524b16a088c72d23221a8d808d0aff45c (patch) | |
tree | 96d1200eef14cc81f88636d953c6bee9a8c7a15e /Zend/zend_execute.c | |
parent | a0a4eb23ee9631e52bd604540a55ba8e66825488 (diff) | |
parent | 70fb0e751913a408e7906adba8bcaff08da44e9e (diff) | |
download | php-git-2147799524b16a088c72d23221a8d808d0aff45c.tar.gz |
Merge branch 'phpng' of https://git.php.net/repository/php-src into phpng
Diffstat (limited to 'Zend/zend_execute.c')
-rw-r--r-- | Zend/zend_execute.c | 41 |
1 files changed, 15 insertions, 26 deletions
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) { |