diff options
| -rw-r--r-- | Zend/zend_execute.c | 6 | ||||
| -rw-r--r-- | 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); } |
