Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Zend/tests/gh21504.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<?php

'1234' |> var_dump(...);
12 changes: 12 additions & 0 deletions Zend/tests/gh21504.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
--TEST--
GH-21504: Incorrect RC-handling for ZEND_EXT_STMT op1
--FILE--
<?php

$php_escaped = getenv('TEST_PHP_EXECUTABLE_ESCAPED');
$cmd = $php_escaped . ' -n -e ' . escapeshellarg(__DIR__ . '/gh21504.inc');
echo shell_exec($cmd);

?>
--EXPECT--
string(4) "1234"
3 changes: 3 additions & 0 deletions Zend/zend_compile.c
Original file line number Diff line number Diff line change
Expand Up @@ -1934,6 +1934,9 @@ static void zend_do_extended_stmt(znode* result) /* {{{ */

opline->opcode = ZEND_EXT_STMT;
if (result) {
if (result->op_type == IS_CONST) {
Z_TRY_ADDREF(result->u.constant);
}
SET_NODE(opline->op1, result);
}
}
Expand Down
Loading