[php-src] PHP-8.5: Merge branch 'PHP-8.4' into PHP-8.5
| From: | Kamil Tekiela | Date: | Thu, 26 Nov 2026 18:57:08 +0000 |
| Subject: | [php-src] PHP-8.5: Merge branch 'PHP-8.4' into PHP-8.5 | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-144233@lists.php.net to get a copy of this message | ||
Author: Kamil Tekiela (kamil-tekiela)
Date: 2026-11-26T18:50:32Z
Commit: https://github.com/php/php-src/commit/9892b3dde18362889f3c1b5d8a816381167158d4
Raw diff: https://github.com/php/php-src/commit/9892b3dde18362889f3c1b5d8a816381167158d4.diff
Merge branch 'PHP-8.4' into PHP-8.5
Changed paths:
A ext/mysqli/tests/gh25779.phpt
M NEWS
M Zend/Optimizer/zend_func_infos.h
M ext/mysqli/mysqli.stub.php
M ext/mysqli/mysqli_arginfo.h
Diff:
diff --git a/NEWS b/NEWS
index 5af0b74016a9..5c7e85f81541 100644
--- a/NEWS
+++ b/NEWS
@@ -106,6 +106,11 @@ PHP NEWS
. Fixed the JIT freeing the string returned by mb_encode_mimeheader() or
mb_output_handler() while it is still in use. (Ilia Alshanetsky)
+- 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 bug GH-25165 (Tracing JIT loops forever once opcache.jit_buffer_size
is exhausted while compiling side traces). (Ilia Alshanetsky)
diff --git a/Zend/Optimizer/zend_func_infos.h b/Zend/Optimizer/zend_func_infos.h
index b7b8ef6952da..f175dffea604 100644
--- a/Zend/Optimizer/zend_func_infos.h
+++ b/Zend/Optimizer/zend_func_infos.h
@@ -248,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/ext/mysqli/mysqli.stub.php b/ext/mysqli/mysqli.stub.php
index 370da77e62a2..7773bb7c2394 100644
--- a/ext/mysqli/mysqli.stub.php
+++ b/ext/mysqli/mysqli.stub.php
@@ -1421,7 +1421,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 de7cfa53e0f4..0fa4380ddb61 100644
--- a/ext/mysqli/mysqli_arginfo.h
+++ b/ext/mysqli/mysqli_arginfo.h
@@ -1,5 +1,5 @@
/* This is a generated file, edit the .stub.php file instead.
- * Stub hash: fecde55745fb219cb15fd35a54a71371ef2b8b7d */
+ * Stub hash: 642e9a01d4b29e5fc80ccf09f12616fadf32b817 */
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_mysqli_affected_rows, 0, 1,
MAY_BE_LONG|MAY_BE_STRING)
ZEND_ARG_OBJ_INFO(0, mysql, mysqli, 0)
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