Skip to content

Commit 3e8a7ef

Browse files
address Ilija and Dmitry comments
1 parent 0905a31 commit 3e8a7ef

1 file changed

Lines changed: 4 additions & 14 deletions

File tree

Zend/Optimizer/sccp.c

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -363,8 +363,7 @@ static inline zend_result zval_to_string_offset(zend_long *result, zval *op) {
363363
static inline zend_result fetch_array_elem(zval **result, zval *op1, zval *op2) {
364364
switch (Z_TYPE_P(op2)) {
365365
case IS_NULL:
366-
*result = zend_hash_find(Z_ARR_P(op1), ZSTR_EMPTY_ALLOC());
367-
return SUCCESS;
366+
return FAILURE;
368367
case IS_FALSE:
369368
*result = zend_hash_index_find(Z_ARR_P(op1), 0);
370369
return SUCCESS;
@@ -428,6 +427,9 @@ static inline zend_result ct_eval_isset_isempty(zval *result, uint32_t extended_
428427
}
429428

430429
static inline zend_result ct_eval_isset_dim(zval *result, uint32_t extended_value, zval *op1, zval *op2) {
430+
if (Z_TYPE_P(op2) == IS_NULL) {
431+
return FAILURE;
432+
}
431433
if (Z_TYPE_P(op1) == IS_ARRAY || IS_PARTIAL_ARRAY(op1)) {
432434
zval *value;
433435
if (fetch_array_elem(&value, op1, op2) == FAILURE) {
@@ -1535,12 +1537,6 @@ static void sccp_visit_instr(scdf_ctx *scdf, zend_op *opline, zend_ssa_op *ssa_o
15351537
SKIP_IF_TOP(op1);
15361538
SKIP_IF_TOP(op2);
15371539

1538-
if (op2 && Z_TYPE_P(op2) == IS_NULL) {
1539-
/* Emits deprecation at run-time. */
1540-
SET_RESULT_BOT(result);
1541-
break;
1542-
}
1543-
15441540
if (ct_eval_fetch_dim(&zv, op1, op2, (opline->opcode != ZEND_FETCH_LIST_R)) == SUCCESS) {
15451541
SET_RESULT(result, &zv);
15461542
zval_ptr_dtor_nogc(&zv);
@@ -1552,12 +1548,6 @@ static void sccp_visit_instr(scdf_ctx *scdf, zend_op *opline, zend_ssa_op *ssa_o
15521548
SKIP_IF_TOP(op1);
15531549
SKIP_IF_TOP(op2);
15541550

1555-
if (op2 && Z_TYPE_P(op2) == IS_NULL) {
1556-
/* Emits deprecation at run-time. */
1557-
SET_RESULT_BOT(result);
1558-
break;
1559-
}
1560-
15611551
if (ct_eval_isset_dim(&zv, opline->extended_value, op1, op2) == SUCCESS) {
15621552
SET_RESULT(result, &zv);
15631553
zval_ptr_dtor_nogc(&zv);

0 commit comments

Comments
 (0)