]> granicus.if.org Git - php/commitdiff
Fixed ext/spl/tests/iterator_035.phpt
authorDmitry Stogov <dmitry@zend.com>
Wed, 9 Apr 2014 19:49:58 +0000 (23:49 +0400)
committerDmitry Stogov <dmitry@zend.com>
Wed, 9 Apr 2014 19:49:58 +0000 (23:49 +0400)
Zend/zend_execute.c
ext/spl/spl_array.c

index f303860bd8dc105cc965b4382b16d6c5045c12f3..822ec902a3cc49007aa06c4a00aa6f09e4907bcb 100644 (file)
@@ -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 {
index 3bd4b3df317dd612811cbdab9200e180d22337b0..afd3fc6af721a5c1213a228de89e7fb1baa4a557 100644 (file)
@@ -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);
        }