diff options
Diffstat (limited to 'Zend/zend_execute.c')
-rw-r--r-- | Zend/zend_execute.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c index a9fadd10da..b5ad563590 100644 --- a/Zend/zend_execute.c +++ b/Zend/zend_execute.c @@ -1014,6 +1014,7 @@ static zend_always_inline zval *zend_fetch_dimension_address_inner(HashTable *ht zend_string *offset_key; zend_ulong hval; +try_again: if (EXPECTED(Z_TYPE_P(dim) == IS_LONG)) { hval = Z_LVAL_P(dim); num_index: @@ -1101,6 +1102,9 @@ str_index: case IS_TRUE: hval = 1; goto num_index; + case IS_REFERENCE: + dim = Z_REFVAL_P(dim); + goto try_again; default: zend_error(E_WARNING, "Illegal offset type"); retval = (type == BP_VAR_W || type == BP_VAR_RW) ? @@ -1118,6 +1122,7 @@ static zend_never_inline zend_long zend_check_string_offset(zval *container, zva zend_error_noreturn(E_ERROR, "[] operator not supported for strings"); } +try_again: if (UNEXPECTED(Z_TYPE_P(dim) != IS_LONG)) { switch(Z_TYPE_P(dim)) { case IS_STRING: @@ -1134,6 +1139,9 @@ static zend_never_inline zend_long zend_check_string_offset(zval *container, zva case IS_TRUE: zend_error(E_NOTICE, "String offset cast occurred"); break; + case IS_REFERENCE: + dim = Z_REFVAL_P(dim); + goto try_again; default: zend_error(E_WARNING, "Illegal offset type"); break; @@ -1269,13 +1277,13 @@ static zend_always_inline void zend_fetch_dimension_address_read(zval *result, z { zval *retval; - ZVAL_DEREF(container); if (EXPECTED(Z_TYPE_P(container) == IS_ARRAY)) { retval = zend_fetch_dimension_address_inner(Z_ARRVAL_P(container), dim, dim_type, type TSRMLS_CC); ZVAL_COPY(result, retval); } else if (EXPECTED(Z_TYPE_P(container) == IS_STRING)) { zend_long offset; +try_again: if (UNEXPECTED(Z_TYPE_P(dim) != IS_LONG)) { switch(Z_TYPE_P(dim)) { /* case IS_LONG: */ @@ -1295,6 +1303,9 @@ static zend_always_inline void zend_fetch_dimension_address_read(zval *result, z zend_error(E_NOTICE, "String offset cast occurred"); } break; + case IS_REFERENCE: + dim = Z_REFVAL_P(dim); + goto try_again; default: zend_error(E_WARNING, "Illegal offset type"); break; |