You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
mysqli_fetch_object() crashes with JIT when the constructor keeps a reference and the result is discarded #25779
With opcache.jit=tracing, the JIT frees the objects once load() is hot. When load() is called 1,000 times in a loop, count(array_unique(array_map('spl_object_id', Row::$rows))) gives int(62) instead of int(1000), because new objects reuse the slots of objects that Row::$rows still holds.
mysqli_fetch_object() calls the constructor on the object it returns, and the constructor can keep a reference to $this. The stub still declares @refcount 1, so the JIT destroys the object when the result is discarded, while Row::$rows still holds it. A debug build with ZEND_VERIFY_FUNC_INFO reports mysqli_fetch_object() missing rcn. The method mysqli_result::fetch_object() is not affected.
I have a patch with a test and will open a PR against PHP-8.4.
PHP Version
PHP 8.5.12 (cli) (built: Oct 28 2026 01:20:43) (NTS)
Copyright (c) The PHP Group
Built by https://github.com/docker-library/php
Zend Engine v4.5.12, Copyright (c) Zend Technologies
with Zend OPcache v8.5.12, Copyright (c), by Zend Technologies
Also reproduced with PHP 8.4.27 and the current PHP-8.4, PHP-8.5, PHP-8.6 and master branches.
Operating System
Debian 13 (php:8.5-cli Docker image with the mysqli extension, MySQL 8.4.13)
Activity
Fix phpGH-25779: mysqli_fetch_object() crashes with JIT when the cons…
Fix GH-25779: mysqli_fetch_object() crashes with JIT when the constru…
Merge branch 'PHP-8.4' into fix-nts-rinit-admission
[ci skip] Merge branch 'PHP-8.4' into fix/phpgh-24701-trait-const-type