Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,8 @@ PHP NEWS
. Fix opcache phar check. (ndossche)
. 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 build and test compatibility with OpenSSL 4.0 and 4.1.
Expand Down
16 changes: 11 additions & 5 deletions ext/opcache/zend_accelerator_module.c
Original file line number Diff line number Diff line change
Expand Up @@ -367,27 +367,33 @@ 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) {
zend_persistent_script *persistent_script = zend_accel_hash_find(&ZCSG(hash), key);
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 accel_file_in_cache(INTERNAL_FUNCTION_PARAMETERS)
Expand Down
Loading