Skip to content

Commit 1a7006c

Browse files
committed
Only wrap against references when needed.
1 parent 702c064 commit 1a7006c

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

Zend/zend_compile.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6436,10 +6436,15 @@ static void zend_compile_pipe(znode *result, zend_ast *ast)
64366436
znode operand_result;
64376437
zend_compile_expr(&operand_result, operand_ast);
64386438

6439-
/* Wrap the value in a ZEND_QM_ASSIGN opcode to ensure references
6440-
* always fail. Otherwise, they'd only fail in complex cases like arrays. */
6439+
/* Wrap simple values in a ZEND_QM__ASSIGN opcode to ensure references
6440+
* always fail. They will already fail in complex cases like arrays,
6441+
* so those don't need a wrapper. */
64416442
znode wrapped_operand_result;
6442-
zend_emit_op_tmp(&wrapped_operand_result, ZEND_QM_ASSIGN, &operand_result, NULL);
6443+
if (operand_result.op_type & (IS_CV|IS_VAR)) {
6444+
zend_emit_op_tmp(&wrapped_operand_result, ZEND_QM_ASSIGN, &operand_result, NULL);
6445+
} else {
6446+
wrapped_operand_result = operand_result;
6447+
}
64436448

64446449
/* Turn the operand into a function parameter list. */
64456450
zend_ast *arg_list_ast = zend_ast_create_list(1, ZEND_AST_ARG_LIST, zend_ast_create_znode(&wrapped_operand_result));

0 commit comments

Comments
 (0)