[php-src] PHP-8.6: Merge branch 'PHP-8.5' into PHP-8.6
| From: | Arnaud Le Blanc | Date: | Mon, 16 Nov 2026 14:38:49 +0000 |
| Subject: | [php-src] PHP-8.6: Merge branch 'PHP-8.5' into PHP-8.6 | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-143739@lists.php.net to get a copy of this message | ||
Author: Arnaud Le Blanc (arnaud-lb)
Date: 2026-11-16T15:37:29+01:00
Commit: https://github.com/php/php-src/commit/48c6b63c23ef14dabf0bf18ca6c7cc68f7c8049f
Raw diff: https://github.com/php/php-src/commit/48c6b63c23ef14dabf0bf18ca6c7cc68f7c8049f.diff
Merge branch 'PHP-8.5' into PHP-8.6
* PHP-8.5:
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 17be7f4a9202..cca27c2d71cf 100644
--- a/NEWS
+++ b/NEWS
@@ -97,6 +97,8 @@ PHP NEWS
isset()/empty(). (Jorg Sowa)
. Fixed bug GH-8739 (OPcache restart corrupts SHM in threaded SAPIs).
(pavimus)
+ . Fixed opcache.enable_file_override lookups racing with OPcache restarts
+ (pavimus)
- OpenSSL:
. Fixed bug GH-25172 (TLS session reuse shares request-lifetime callback
diff --git a/ext/opcache/zend_accelerator_module.c b/ext/opcache/zend_accelerator_module.c
index 2c290d8d5f8a..06f3f0345031 100644
--- a/ext/opcache/zend_accelerator_module.c
+++ b/ext/opcache/zend_accelerator_module.c
@@ -379,6 +379,12 @@ ZEND_INI_END()
static bool filename_is_in_cache(zend_string *filename)
{
zend_string *key;
+ bool 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 false;
+ }
key = accel_make_persistent_key(filename);
if (key != NULL) {
@@ -386,19 +392,19 @@ static bool filename_is_in_cache(zend_string *filename)
if (persistent_script && !persistent_script->corrupted) {
if (ZCG(accel_directives).validate_timestamps) {
zend_file_handle handle;
- bool ret;
zend_stream_init_filename_ex(&handle, filename);
ret = validate_timestamp_and_record_ex(persistent_script, &handle) == SUCCESS;
zend_destroy_file_handle(&handle);
- return ret;
+ } else {
+ ret = true;
}
-
- return true;
}
}
- return false;
+ accelerator_shm_read_unlock();
+
+ return ret;
}
static bool filename_is_in_file_cache(zend_string *filename)