Skip to content

Commit afd9639

Browse files
committed
Revert "Use RW fetch for argument unpacking"
This reverts commit 6913ec3. This reverts commit a9e332e. Causes https://bugs.php.net/bug.php?id=78356, which I don't have a good solution for.
1 parent 1f9a77b commit afd9639

File tree

5 files changed

+3
-42
lines changed

5 files changed

+3
-42
lines changed

Zend/tests/arg_unpack/nested_by_ref.phpt

Lines changed: 0 additions & 22 deletions
This file was deleted.

Zend/zend_compile.c

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2963,15 +2963,7 @@ uint32_t zend_compile_args(zend_ast *ast, zend_function *fbc) /* {{{ */
29632963
uses_arg_unpack = 1;
29642964
fbc = NULL;
29652965

2966-
/* Unpacking may need to create interior references in the unpacked array,
2967-
* but apart from that does not have any other reference semantics: It should
2968-
* generate a notice if the variable does not exist and it should not convert
2969-
* the variable itself into a reference. As such, use an RW fetch. */
2970-
if (zend_is_variable(arg->child[0])) {
2971-
zend_compile_var(&arg_node, arg->child[0], BP_VAR_RW, 0);
2972-
} else {
2973-
zend_compile_expr(&arg_node, arg->child[0]);
2974-
}
2966+
zend_compile_expr(&arg_node, arg->child[0]);
29752967
opline = zend_emit_op(NULL, ZEND_SEND_UNPACK, &arg_node, NULL);
29762968
opline->op2.num = arg_count;
29772969
opline->result.var = (uint32_t)(zend_intptr_t)ZEND_CALL_ARG(NULL, arg_count);

Zend/zend_vm_def.h

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4920,11 +4920,7 @@ ZEND_VM_HANDLER(165, ZEND_SEND_UNPACK, ANY, ANY)
49204920
int arg_num;
49214921

49224922
SAVE_OPLINE();
4923-
if (OP1_TYPE & (IS_VAR|IS_CV)) {
4924-
args = GET_OP1_ZVAL_PTR_PTR_UNDEF(BP_VAR_RW);
4925-
} else {
4926-
args = GET_OP1_ZVAL_PTR_UNDEF(BP_VAR_R);
4927-
}
4923+
args = GET_OP1_ZVAL_PTR_UNDEF(BP_VAR_R);
49284924
arg_num = ZEND_CALL_NUM_ARGS(EX(call)) + 1;
49294925

49304926
ZEND_VM_C_LABEL(send_again):

Zend/zend_vm_execute.h

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1862,11 +1862,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SEND_UNPACK_SPEC_HANDLER(ZEND_
18621862
int arg_num;
18631863

18641864
SAVE_OPLINE();
1865-
if (opline->op1_type & (IS_VAR|IS_CV)) {
1866-
args = get_zval_ptr_ptr_undef(opline->op1_type, opline->op1, &free_op1, BP_VAR_RW);
1867-
} else {
1868-
args = get_zval_ptr_undef(opline->op1_type, opline->op1, &free_op1, BP_VAR_R);
1869-
}
1865+
args = get_zval_ptr_undef(opline->op1_type, opline->op1, &free_op1, BP_VAR_R);
18701866
arg_num = ZEND_CALL_NUM_ARGS(EX(call)) + 1;
18711867

18721868
send_again:

ext/opcache/Optimizer/zend_inference.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3439,7 +3439,6 @@ static int zend_update_type_info(const zend_op_array *op_array,
34393439
case ZEND_SEND_VAR_NO_REF:
34403440
case ZEND_SEND_VAR_NO_REF_EX:
34413441
case ZEND_SEND_REF:
3442-
case ZEND_SEND_UNPACK:
34433442
case ZEND_ASSIGN_REF:
34443443
case ZEND_YIELD:
34453444
case ZEND_INIT_ARRAY:

0 commit comments

Comments
 (0)