1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00

Merge branch 'PHP-8.5'

* PHP-8.5:
  Fix borked SCCP of array containing partial object
This commit is contained in:
Ilija Tovilo
2026-02-17 18:12:15 +01:00
2 changed files with 25 additions and 2 deletions

View File

@@ -968,7 +968,7 @@ static void sccp_visit_instr(scdf_ctx *scdf, zend_op *opline, zend_ssa_op *ssa_o
SET_RESULT(op1, &zv);
} else if (ct_eval_assign_dim(&zv, data, op2) == SUCCESS) {
/* Mark array containing partial array as partial */
if (IS_PARTIAL_ARRAY(data)) {
if (IS_PARTIAL_ARRAY(data) || IS_PARTIAL_OBJECT(data)) {
MAKE_PARTIAL_ARRAY(&zv);
}
SET_RESULT(result, data);
@@ -1173,7 +1173,7 @@ static void sccp_visit_instr(scdf_ctx *scdf, zend_op *opline, zend_ssa_op *ssa_o
/* We can't add NEXT element into partial array (skip it) */
SET_RESULT(result, &zv);
} else if (ct_eval_add_array_elem(&zv, op1, op2) == SUCCESS) {
if (IS_PARTIAL_ARRAY(op1)) {
if (IS_PARTIAL_ARRAY(op1) || IS_PARTIAL_OBJECT(op1)) {
MAKE_PARTIAL_ARRAY(&zv);
}
SET_RESULT(result, &zv);

View File

@@ -0,0 +1,23 @@
--TEST--
GH-21227: Borked SCCP of array containing partial object
--CREDITS--
Daniel Chong (chongwick)
--EXTENSIONS--
opcache
--INI--
opcache.enable=1
opcache.enable_cli=1
--FILE--
<?php
function test() {
$obj->a = 3;
$objs = [];
$obj = new stdClass;
$objs[] = $obj;
}
?>
===DONE===
--EXPECT--
===DONE===