[php-src] PR #25202: Fix GH-24361: Restore GC after opcache_compile_file errors

From: Date: Thu, 05 Nov 2026 08:37:25 +0000
Subject: [php-src] PR #25202: Fix GH-24361: Restore GC after opcache_compile_file errors
Groups: php.git-pulls 
Request: Send a blank email to git-pulls+get-40313@lists.php.net to get a copy of this message
Pull Request: https://github.com/php/php-src/pull/25202 Author: akasakariko > AI-assisted implementation and PR description > > ## Summary > - Restore the pre-error GC protection state after a direct compiler error caught by > opcache_compile_file() > - Preserve protection for runtime fatals, errors that unwind user callbacks and an already > protected collector > - Keep the existing diagnostics, false return value and preload failure behavior > > ## Implementation > Record the fatal error type, execution frame and GC protection through a thread-local error > observer before bailout clears the execution frame > > Restore protection only for E_COMPILE_ERROR from the current > opcache_compile_file() frame and when no OOM has occurred > > The observer avoids relying on last_error_type, which can > remain stale when repeated errors are suppressed, including when a later runtime fatal has the same > message > > ## Verification > - Reproduced on unmodified revision > 7c0b9008963e0fbffd4d71f92e01e2ac2b8ec410, GC becomes protected and > collects zero cycles after the reported failure > - The same reproduction after the fix keeps GC unprotected and collects 99999 cycles > - Add five PHPT tests covering manual and automatic GC, uncached compilation, disabled > automatic GC, a throwing warning handler, repeated errors, nested fatal compilation and memory > exhaustion > - Regression tests pass with debug NTS and ZTS builds in shared-memory, file-cache-only and > tracing JIT modes > - Zend, OPcache, zend_test, language and basic suites on macOS ARM64 have no unexpected > failures > - NTS results are 6375 passed, 202 skipped and 2 expected failures > - ZTS results are 6371 passed, 206 skipped and 2 expected failures Fixes #24361

« previous php.git-pulls (#40313) next »