From 29f068779f14cee4aac65f8c04f1a57a44013e34 Mon Sep 17 00:00:00 2001 From: Dmitry Stogov Date: Wed, 9 Apr 2014 23:49:58 +0400 Subject: [PATCH] Fixed ext/spl/tests/iterator_035.phpt --- Zend/zend_execute.c | 6 ++++-- ext/spl/spl_array.c | 4 +++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c index f303860bd8..822ec902a3 100644 --- a/Zend/zend_execute.c +++ b/Zend/zend_execute.c @@ -1160,7 +1160,9 @@ convert_to_array: //??? } retval = Z_OBJ_HT_P(container)->read_dimension(container, dim, type, result TSRMLS_CC); - if (retval && Z_TYPE_P(retval) != IS_UNDEF) { + if (UNEXPECTED(retval == &EG(uninitialized_zval))) { + ZVAL_NULL(result); + } else if (retval && Z_TYPE_P(retval) != IS_UNDEF) { if (!Z_ISREF_P(retval)) { if (Z_REFCOUNTED_P(retval) && Z_REFCOUNT_P(retval) > 1) { @@ -1182,7 +1184,7 @@ convert_to_array: //??? PZVAL_LOCK(retval); //??? ZVAL_COPY(result, retval); if (result != retval) { - if (is_ref && retval != &EG(uninitialized_zval)) { + if (is_ref) { SEPARATE_ZVAL_TO_MAKE_IS_REF(retval); ZVAL_COPY(result, retval); } else { diff --git a/ext/spl/spl_array.c b/ext/spl/spl_array.c index 3bd4b3df31..afd3fc6af7 100644 --- a/ext/spl/spl_array.c +++ b/ext/spl/spl_array.c @@ -428,7 +428,9 @@ static zval *spl_array_read_dimension_ex(int check_inherited, zval *object, zval * by separating (if necessary) and returning as an is_ref=1 zval (even if refcount == 1) */ - if ((type == BP_VAR_W || type == BP_VAR_RW || type == BP_VAR_UNSET) && !Z_ISREF_P(ret)) { + if ((type == BP_VAR_W || type == BP_VAR_RW || type == BP_VAR_UNSET) && + !Z_ISREF_P(ret) && + EXPECTED(ret != &EG(uninitialized_zval))) { ZVAL_NEW_REF(ret, ret); } -- 2.50.1