Skip to content

Commit 196dd1d

Browse files
committed
Add check in assign-to-self branch
1 parent 1505204 commit 196dd1d

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

Zend/zend_compile.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3049,7 +3049,12 @@ void zend_compile_assign(znode *result, zend_ast *ast) /* {{{ */
30493049
znode cv_node;
30503050

30513051
if (zend_try_compile_cv(&cv_node, expr_ast) == FAILURE) {
3052-
zend_compile_simple_var_no_cv(&expr_node, expr_ast, BP_VAR_R, 0);
3052+
if (zend_compile_list_assign_requires_w(var_ast)) {
3053+
zend_compile_simple_var_no_cv(&expr_node, expr_ast, BP_VAR_W, 0);
3054+
zend_emit_op(&expr_node, ZEND_MAKE_REF, &expr_node, NULL);
3055+
} else {
3056+
zend_compile_simple_var_no_cv(&expr_node, expr_ast, BP_VAR_R, 0);
3057+
}
30533058
} else {
30543059
zend_emit_op(&expr_node, ZEND_QM_ASSIGN, &cv_node, NULL);
30553060
}

0 commit comments

Comments
 (0)