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

From: Date: Thu, 26 Nov 2026 18:57:11 +0000
Subject: [php-src] master: Merge branch 'PHP-8.6'
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-144235@lists.php.net to get a copy of this message
Author: Kamil Tekiela (kamil-tekiela) Date: 2026-11-26T18:56:15Z Commit: https://github.com/php/php-src/commit/8dc812539dd2bf327605aba1c880eaa7c55e212a Raw diff: https://github.com/php/php-src/commit/8dc812539dd2bf327605aba1c880eaa7c55e212a.diff Merge branch 'PHP-8.6' Changed paths: A Zend/tests/clone/gh25788.phpt A ext/mysqli/tests/gh25779.phpt M NEWS M Zend/Optimizer/zend_func_infos.h M Zend/zend_builtin_functions.stub.php M Zend/zend_builtin_functions_arginfo.h M ext/mysqli/mysqli.stub.php M ext/mysqli/mysqli_arginfo.h Diff: diff --git a/NEWS b/NEWS index 13c2a82bbbbe..a1b658ea9d27 100644 --- a/NEWS +++ b/NEWS @@ -11,6 +11,8 @@ PHP NEWS . Improved performance of integer to string conversion, used by string casts, echo, implode(), json_encode(), serialize() and other places, by emitting two digits per step. (Alexander Danilov) + . Fixed bug GH-25788 (clone() with properties corrupts memory with JIT when + __clone() keeps a reference and the result is discarded). (Tomasz Kowalczyk) - Curl: . Negative values for CURLOPT_POSTREDIR are now rejected, causing @@ -101,6 +103,11 @@ PHP NEWS . Fixed bug GH-24609 (OK packets without an info message rejected on x32 builds). (lazerg) +- MySQLi: + . Fixed bug GH-25779 (mysqli_fetch_object() crashes with JIT when the + constructor keeps a reference and the result is discarded). + (Tomasz Kowalczyk) + - Opcache: . Fixed range inference of assignments through typed references. (Ilia Alshanetsky) diff --git a/Zend/Optimizer/zend_func_infos.h b/Zend/Optimizer/zend_func_infos.h index b2aa7b77950f..8dee522f6965 100644 --- a/Zend/Optimizer/zend_func_infos.h +++ b/Zend/Optimizer/zend_func_infos.h @@ -1,7 +1,6 @@ /* This is a generated file, edit the .stub.php files instead. */ static const func_info_t func_infos[] = { - F1("clone", MAY_BE_OBJECT), F1("zend_version", MAY_BE_STRING), FN("func_get_args", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_LONG|MAY_BE_ARRAY_OF_ANY), F1("get_class_vars", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_STRING|MAY_BE_ARRAY_OF_ANY|MAY_BE_ARRAY_OF_REF), @@ -249,7 +248,6 @@ static const func_info_t func_infos[] = { F1("mysqli_fetch_all", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_LONG|MAY_BE_ARRAY_KEY_STRING|MAY_BE_ARRAY_OF_ANY), F1("mysqli_fetch_array", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_LONG|MAY_BE_ARRAY_KEY_STRING|MAY_BE_ARRAY_OF_ANY|MAY_BE_NULL|MAY_BE_FALSE), F1("mysqli_fetch_assoc", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_LONG|MAY_BE_ARRAY_KEY_STRING|MAY_BE_ARRAY_OF_ANY|MAY_BE_NULL|MAY_BE_FALSE), - F1("mysqli_fetch_object", MAY_BE_OBJECT|MAY_BE_NULL|MAY_BE_FALSE), F1("mysqli_fetch_row", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_LONG|MAY_BE_ARRAY_OF_ANY|MAY_BE_NULL|MAY_BE_FALSE), F1("mysqli_get_connection_stats", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_STRING|MAY_BE_ARRAY_OF_ANY), F1("mysqli_get_client_stats", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_STRING|MAY_BE_ARRAY_OF_STRING), diff --git a/Zend/tests/clone/gh25788.phpt b/Zend/tests/clone/gh25788.phpt new file mode 100644 index 000000000000..2c388c6512e1 --- /dev/null +++ b/Zend/tests/clone/gh25788.phpt @@ -0,0 +1,42 @@ +--TEST-- +GH-25788: clone() with properties corrupts memory with JIT when __clone() keeps a reference and the result is discarded +--EXTENSIONS-- +opcache +--INI-- +opcache.enable=1 +opcache.enable_cli=1 +opcache.jit=function +opcache.jit_buffer_size=64M +opcache.file_update_protection=0 +--FILE-- +<?php + +class Row { + public static array $rows = []; + + public int $id = 1; + + public function __clone() { + self::$rows[] = $this; + } + + public function __destruct() { echo "destruct\n"; } +} + +function test(Row $row) { + clone($row, ['id' => 2]); +} + +test(new Row()); +var_dump(Row::$rows); +?> +--EXPECTF-- +destruct +array(1) { + [0]=> + object(Row)#%d (1) { + ["id"]=> + int(2) + } +} +destruct diff --git a/Zend/zend_builtin_functions.stub.php b/Zend/zend_builtin_functions.stub.php index 16ce7e2be8ca..f548e221d770 100644 --- a/Zend/zend_builtin_functions.stub.php +++ b/Zend/zend_builtin_functions.stub.php @@ -7,7 +7,6 @@ class stdClass { } -/** @refcount 1 */ function clone(object $object, array $withProperties = []): object {} function exit(string|int $status = 0): never {} diff --git a/Zend/zend_builtin_functions_arginfo.h b/Zend/zend_builtin_functions_arginfo.h index 2fba874a8e93..86e8567e4da3 100644 --- a/Zend/zend_builtin_functions_arginfo.h +++ b/Zend/zend_builtin_functions_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit zend_builtin_functions.stub.php instead. - * Stub hash: 5d7145b7bc305bb50b45e75c02740206148223b1 */ + * Stub hash: d789f1e73220716b443b153ba0c84e2c010a691b */ #include "zend_attributes.h" diff --git a/ext/mysqli/mysqli.stub.php b/ext/mysqli/mysqli.stub.php index 6ff946299ddf..456632475a8d 100644 --- a/ext/mysqli/mysqli.stub.php +++ b/ext/mysqli/mysqli.stub.php @@ -1433,7 +1433,6 @@ function mysqli_fetch_array(mysqli_result $result, int $mode = MYSQLI_BOTH): arr */ function mysqli_fetch_assoc(mysqli_result $result): array|null|false {} -/** @refcount 1 */ function mysqli_fetch_object(mysqli_result $result, string $class = "stdClass", array $constructor_args = []): object|null|false {} /** diff --git a/ext/mysqli/mysqli_arginfo.h b/ext/mysqli/mysqli_arginfo.h index dac51d7f4959..709342d6b71e 100644 --- a/ext/mysqli/mysqli_arginfo.h +++ b/ext/mysqli/mysqli_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit mysqli.stub.php instead. - * Stub hash: f5327d48b275a5358b740232281478c83bb8a3db */ + * Stub hash: d120933a1b62b7b9e6d19e797b7841a02913c2bf */ #include "zend_attributes.h" #include "zend_constants.h" diff --git a/ext/mysqli/tests/gh25779.phpt b/ext/mysqli/tests/gh25779.phpt new file mode 100644 index 000000000000..d89f8deb180a --- /dev/null +++ b/ext/mysqli/tests/gh25779.phpt @@ -0,0 +1,47 @@ +--TEST-- +GH-25779: mysqli_fetch_object() crashes with JIT when the constructor keeps a reference and the result is discarded +--EXTENSIONS-- +mysqli +opcache +--SKIPIF-- +<?php +require_once __DIR__ . '/test_setup/test_helpers.inc'; +mysqli_check_skip_test(); +?> +--INI-- +opcache.enable=1 +opcache.enable_cli=1 +opcache.jit=function +opcache.jit_buffer_size=64M +opcache.file_update_protection=0 +--FILE-- +<?php +require_once __DIR__ . '/test_setup/test_helpers.inc'; + +class Row { + public static array $rows = []; + + public function __construct() { + self::$rows[] = $this; + } + + public function __destruct() { echo "destruct\n"; } +} + +function test(mysqli_result $result) { + mysqli_fetch_object($result, Row::class); +} + +$link = default_mysqli_connect(); +test(mysqli_query($link, "SELECT 1 AS id")); +var_dump(Row::$rows); +?> +--EXPECTF-- +array(1) { + [0]=> + object(Row)#%d (1) { + ["id"]=> + string(1) "1" + } +} +destruct

« previous php.cvs (#144235) next »