Skip to content

Commit 87b8345

Browse files
committed
Merge branch 'PHP-8.5'
* PHP-8.5: Fix incorrect RC-handling for ZEND_EXT_STMT op1
2 parents d4db3a9 + d4f0691 commit 87b8345

File tree

3 files changed

+18
-0
lines changed

3 files changed

+18
-0
lines changed

Zend/tests/gh21504.inc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<?php
2+
3+
'1234' |> var_dump(...);

Zend/tests/gh21504.phpt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
--TEST--
2+
GH-21504: Incorrect RC-handling for ZEND_EXT_STMT op1
3+
--FILE--
4+
<?php
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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1950,6 +1950,9 @@ static void zend_do_extended_stmt(znode* result) /* {{{ */
19501950

19511951
opline->opcode = ZEND_EXT_STMT;
19521952
if (result) {
1953+
if (result->op_type == IS_CONST) {
1954+
Z_TRY_ADDREF(result->u.constant);
1955+
}
19531956
SET_NODE(opline->op1, result);
19541957
}
19551958
}

0 commit comments

Comments
 (0)