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

From: Date: Mon, 05 Oct 2026 18:00:57 +0000
Subject: [php-src] master: Merge branch 'PHP-8.6'
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-141978@lists.php.net to get a copy of this message
Author: ndossche (ndossche) Date: 2026-10-05T20:00:39+02:00 Commit: https://github.com/php/php-src/commit/594dfbe04b3540b4fb354125faddbe35476845eb Raw diff: https://github.com/php/php-src/commit/594dfbe04b3540b4fb354125faddbe35476845eb.diff Merge branch 'PHP-8.6' * PHP-8.6: Fix SCCP evaluation of isset()/empty() on dimension of non-escaping object Changed paths: A ext/opcache/tests/opt/sccp_isset_dim_partial_object.phpt M Zend/Optimizer/sccp.c Diff: diff --git a/Zend/Optimizer/sccp.c b/Zend/Optimizer/sccp.c index 48f67a662e40..07de22f85352 100644 --- a/Zend/Optimizer/sccp.c +++ b/Zend/Optimizer/sccp.c @@ -456,7 +456,11 @@ static inline zend_result ct_eval_isset_dim(zval *result, uint32_t extended_valu ZVAL_BOOL(result, rv); return SUCCESS; + } else if (IS_PARTIAL_OBJECT(op1)) { + /* Objects may implement ArrayAccess or throw. */ + return FAILURE; } else { + ZEND_ASSERT(Z_TYPE_P(op1) <= IS_DOUBLE); ZVAL_BOOL(result, (extended_value & ZEND_ISEMPTY)); return SUCCESS; } diff --git a/ext/opcache/tests/opt/sccp_isset_dim_partial_object.phpt b/ext/opcache/tests/opt/sccp_isset_dim_partial_object.phpt new file mode 100644 index 000000000000..ac10d6773c68 --- /dev/null +++ b/ext/opcache/tests/opt/sccp_isset_dim_partial_object.phpt @@ -0,0 +1,36 @@ +--TEST-- +SCCP: isset()/empty() on dimension of non-escaping object must not be evaluated +--INI-- +opcache.enable=1 +opcache.enable_cli=1 +opcache.optimization_level=-1 +--EXTENSIONS-- +opcache +--FILE-- +<?php +class P {} + +function f() { + $o = new P; + return isset($o[1]); +} + +function g() { + $o = new P; + return empty($o[1]); +} + +try { + var_dump(f()); +} catch (Error $e) { + echo $e->getMessage(), "\n"; +} +try { + var_dump(g()); +} catch (Error $e) { + echo $e->getMessage(), "\n"; +} +?> +--EXPECT-- +Cannot use object of type P as array +Cannot use object of type P as array

« previous php.cvs (#141978) next »