Skip to content

Commit 591af29

Browse files
committed
Simplify auto-vivification check
1 parent cb81406 commit 591af29

File tree

1 file changed

+7
-11
lines changed

1 file changed

+7
-11
lines changed

Zend/zend_execute.c

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3064,17 +3064,13 @@ static zend_never_inline void zend_fetch_object_dimension_address(zval *result,
30643064
goto clean_up;
30653065
}
30663066
/* Check if we need to auto-vivify a possible null return */
3067-
if (Z_ISREF_P(result) && Z_ISNULL_P(Z_REFVAL_P(result))) {
3068-
const zend_op *next_opline = execute_data->opline + 1;
3069-
if (UNEXPECTED(
3070-
next_opline->opcode == ZEND_ASSIGN_DIM
3071-
|| next_opline->opcode == ZEND_ASSIGN_DIM_OP
3072-
|| next_opline->opcode == ZEND_FETCH_DIM_W
3073-
|| next_opline->opcode == ZEND_FETCH_DIM_RW
3074-
)) {
3075-
// TODO THIS IS A VERY CRUDE PROTOTYPE
3076-
object_init_ex(Z_REFVAL_P(result), obj->ce);
3077-
}
3067+
if (UNEXPECTED(
3068+
opline->extended_value == ZEND_FETCH_DIM_DIM
3069+
&& Z_ISREF_P(result)
3070+
&& Z_ISNULL_P(Z_REFVAL_P(result))
3071+
)) {
3072+
// TODO THIS IS A VERY CRUDE PROTOTYPE
3073+
object_init_ex(Z_REFVAL_P(result), obj->ce);
30783074
}
30793075
if (result != retval) {
30803076
ZVAL_INDIRECT(result, retval);

0 commit comments

Comments
 (0)