Skip to content

Commit ae0575d

Browse files
committed
Don't emit ZEND_DEREF in stmt context
1 parent 2be9462 commit ae0575d

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

Zend/zend_compile.c

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3611,19 +3611,23 @@ static void zend_compile_assign_ref(znode *result, zend_ast *ast, uint32_t type)
36113611
opline->extended_value &= ~ZEND_FETCH_REF;
36123612
opline->extended_value |= flags;
36133613
zend_emit_op_data(&source_node);
3614-
*result = target_node;
3614+
if (result) {
3615+
*result = target_node;
3616+
}
36153617
} else if (opline && opline->opcode == ZEND_FETCH_STATIC_PROP_W) {
36163618
opline->opcode = ZEND_ASSIGN_STATIC_PROP_REF;
36173619
opline->extended_value &= ~ZEND_FETCH_REF;
36183620
opline->extended_value |= flags;
36193621
zend_emit_op_data(&source_node);
3620-
*result = target_node;
3622+
if (result) {
3623+
*result = target_node;
3624+
}
36213625
} else {
36223626
opline = zend_emit_op(result, ZEND_ASSIGN_REF, &target_node, &source_node);
36233627
opline->extended_value = flags;
36243628
}
36253629

3626-
if (type == BP_VAR_R || type == BP_VAR_IS) {
3630+
if (result && (type == BP_VAR_R || type == BP_VAR_IS)) {
36273631
znode tmp_result = *result;
36283632
zend_emit_op_tmp(result, ZEND_DEREF, &tmp_result, NULL);
36293633
}
@@ -11934,6 +11938,9 @@ static void zend_compile_stmt(zend_ast *ast) /* {{{ */
1193411938
case ZEND_AST_CAST_VOID:
1193511939
zend_compile_void_cast(NULL, ast);
1193611940
break;
11941+
case ZEND_AST_ASSIGN_REF:
11942+
zend_compile_assign_ref(NULL, ast, BP_VAR_R);
11943+
return;
1193711944
default:
1193811945
{
1193911946
znode result;

0 commit comments

Comments
 (0)