[php-src] PHP-8.5: Merge branch 'PHP-8.4' into PHP-8.5

From: Date: Mon, 16 Nov 2026 14:38:48 +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-143738@lists.php.net to get a copy of this message
Author: Arnaud Le Blanc (arnaud-lb) Date: 2026-11-16T15:36:31+01:00 Commit: https://github.com/php/php-src/commit/9e53e04dda9fc59985e4664e765bcc3f9d060932 Raw diff: https://github.com/php/php-src/commit/9e53e04dda9fc59985e4664e765bcc3f9d060932.diff Merge branch 'PHP-8.4' into PHP-8.5 * PHP-8.4: Fix opcache.enable_file_override lookups racing with OPcache restarts (#25483) Changed paths: M NEWS M ext/opcache/zend_accelerator_module.c Diff: diff --git a/NEWS b/NEWS index 1d5dc70a89b8..2456029cfbef 100644 --- a/NEWS +++ b/NEWS @@ -77,6 +77,8 @@ PHP NEWS before property helpers). (ndossche, Alessio Attilio) . Fixed bug GH-8739 (OPcache restart corrupts SHM in threaded SAPIs). (pavimus) + . Fixed opcache.enable_file_override lookups racing with OPcache restarts + (pavimus) - PDO_Firebird: . Fixed stack buffer overflow with long connection user names, passwords, diff --git a/ext/opcache/zend_accelerator_module.c b/ext/opcache/zend_accelerator_module.c index b3afa2d95ef4..8bdcae8b2266 100644 --- a/ext/opcache/zend_accelerator_module.c +++ b/ext/opcache/zend_accelerator_module.c @@ -382,6 +382,12 @@ ZEND_INI_END() static int filename_is_in_cache(zend_string *filename) { zend_string *key; + int ret = 0; + + /* The hash may be cleaned by a restart: only look it up while holding the read lock */ + if (!ZCG(accelerator_enabled) || accelerator_shm_read_lock() != SUCCESS) { + return 0; + } key = accel_make_persistent_key(filename); if (key != NULL) { @@ -389,20 +395,20 @@ static int filename_is_in_cache(zend_string *filename) if (persistent_script && !persistent_script->corrupted) { if (ZCG(accel_directives).validate_timestamps) { zend_file_handle handle; - int ret; zend_stream_init_filename_ex(&handle, filename); ret = validate_timestamp_and_record_ex(persistent_script, &handle) == SUCCESS ? 1 : 0; zend_destroy_file_handle(&handle); - return ret; + } else { + ret = 1; } - - return 1; } } - return 0; + accelerator_shm_read_unlock(); + + return ret; } static int filename_is_in_file_cache(zend_string *filename)

« previous php.cvs (#143738) next »