[php-src] master: Merge branch 'PHP-8.6'

From: Date: Mon, 28 Sep 2026 21:20:21 +0000
Subject: [php-src] master: Merge branch 'PHP-8.6'
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-141645@lists.php.net to get a copy of this message
Author: ndossche (ndossche) Date: 2026-09-28T23:20:05+02:00 Commit: https://github.com/php/php-src/commit/68d5d80744204af5e3e642e5f73af9eb9e024fc0 Raw diff: https://github.com/php/php-src/commit/68d5d80744204af5e3e642e5f73af9eb9e024fc0.diff Merge branch 'PHP-8.6' * PHP-8.6: Fix incorrect DCE due to unsound escape analysis Changed paths: A ext/opcache/tests/opt/dce_015.phpt M Zend/Optimizer/escape_analysis.c Diff: diff --git a/Zend/Optimizer/escape_analysis.c b/Zend/Optimizer/escape_analysis.c index 02f986d6e8fc..ca1cb6c1fdee 100644 --- a/Zend/Optimizer/escape_analysis.c +++ b/Zend/Optimizer/escape_analysis.c @@ -297,8 +297,10 @@ static bool is_escape_use(const zend_op_array *op_array, const zend_ssa *ssa, in case ZEND_ASSIGN_STATIC_PROP_OP: case ZEND_ASSIGN_DIM: case ZEND_ASSIGN_OBJ: - case ZEND_ASSIGN_OBJ_REF: break; + case ZEND_ASSIGN_OBJ_REF: + /* The property may now alias a variable outside of the object. */ + return true; case ZEND_PRE_INC_OBJ: case ZEND_PRE_DEC_OBJ: case ZEND_POST_INC_OBJ: diff --git a/ext/opcache/tests/opt/dce_015.phpt b/ext/opcache/tests/opt/dce_015.phpt new file mode 100644 index 000000000000..a09284cab369 --- /dev/null +++ b/ext/opcache/tests/opt/dce_015.phpt @@ -0,0 +1,45 @@ +--TEST-- +DCE must not remove assignments to properties of an object holding a reference +--INI-- +opcache.enable=1 +opcache.enable_cli=1 +opcache.optimization_level=-1 +opcache.file_update_protection=0 +--EXTENSIONS-- +opcache +--FILE-- +<?php + +class Holder { + public $untyped = 0; + public int $typed = 0; +} + +class Target { + public $untyped = 0; + public int $typed = 0; +} + +function untyped() { + $h = new Holder; + $t = new Target; + $h->untyped = &$t->untyped; + $h->untyped = 5; + var_dump($t->untyped); +} + +function typed() { + $h = new Holder; + $t = new Target; + $h->typed = &$t->typed; + $h->typed = 5; + var_dump($t->typed); +} + +untyped(); +typed(); + +?> +--EXPECT-- +int(5) +int(5)

« previous php.cvs (#141645) next »