]> granicus.if.org Git - php/commitdiff
Improve the codes (FETCH_DIM_R/IS is read context, we should not expose IS_REFERENCE)
authorXinchen Hui <laruence@gmail.com>
Thu, 10 Mar 2016 07:09:51 +0000 (15:09 +0800)
committerXinchen Hui <laruence@gmail.com>
Thu, 10 Mar 2016 07:09:51 +0000 (15:09 +0800)
Zend/zend_execute.c

index 17bc64125a5b72875819ceafa2b271a22db45036..432db9be6795b95c68df127957b581d0ef8abdf0 100644 (file)
@@ -1561,8 +1561,7 @@ num_index:
                                        retval = zend_hash_index_add_new(ht, hval, &EG(uninitialized_zval));
                                        break;
                        }
-               }
-               if (type == BP_VAR_R) {
+               } else if (type == BP_VAR_R) {
                        ZVAL_DEREF(retval);
                }
        } else if (EXPECTED(Z_TYPE_P(dim) == IS_STRING)) {
@@ -1594,9 +1593,10 @@ str_index:
                                                        ZVAL_NULL(retval);
                                                        break;
                                        }
+                               } else if (type == BP_VAR_R) {
+                                       ZVAL_DEREF(retval);
                                }
-                       }
-                       if (type == BP_VAR_R) {
+                       } else if (type == BP_VAR_R) {
                                ZVAL_DEREF(retval);
                        }
                } else {
@@ -1833,7 +1833,7 @@ try_array:
 
 try_string_offset:
                if (UNEXPECTED(Z_TYPE_P(dim) != IS_LONG)) {
-                       switch(Z_TYPE_P(dim)) {
+                       switch (Z_TYPE_P(dim)) {
                                /* case IS_LONG: */
                                case IS_STRING:
                                        if (IS_LONG == is_numeric_string(Z_STRVAL_P(dim), Z_STRLEN_P(dim), NULL, NULL, -1)) {