We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents d4db3a9 + d4f0691 commit 87b8345Copy full SHA for 87b8345
3 files changed
Zend/tests/gh21504.inc
@@ -0,0 +1,3 @@
1
+<?php
2
+
3
+'1234' |> var_dump(...);
Zend/tests/gh21504.phpt
@@ -0,0 +1,12 @@
+--TEST--
+GH-21504: Incorrect RC-handling for ZEND_EXT_STMT op1
+--FILE--
4
5
6
+$php_escaped = getenv('TEST_PHP_EXECUTABLE_ESCAPED');
7
+$cmd = $php_escaped . ' -n -e ' . escapeshellarg(__DIR__ . '/gh21504.inc');
8
+echo shell_exec($cmd);
9
10
+?>
11
+--EXPECT--
12
+string(4) "1234"
Zend/zend_compile.c
@@ -1950,6 +1950,9 @@ static void zend_do_extended_stmt(znode* result) /* {{{ */
1950
1951
opline->opcode = ZEND_EXT_STMT;
1952
if (result) {
1953
+ if (result->op_type == IS_CONST) {
1954
+ Z_TRY_ADDREF(result->u.constant);
1955
+ }
1956
SET_NODE(opline->op1, result);
1957
}
1958
0 commit comments