Skip to content

Commit c54983a

Browse files
author
Mikhail Galanin
committed
Invalidate path even if the file was deleted
1 parent 14b8270 commit c54983a

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

ext/opcache/ZendAccelerator.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1391,6 +1391,7 @@ zend_result zend_accel_invalidate(zend_string *filename, bool force)
13911391
{
13921392
zend_string *realpath;
13931393
zend_persistent_script *persistent_script;
1394+
zend_bool file_found = true;
13941395

13951396
if (!ZCG(accelerator_enabled) || accelerator_shm_read_lock() != SUCCESS) {
13961397
return FAILURE;
@@ -1399,7 +1400,10 @@ zend_result zend_accel_invalidate(zend_string *filename, bool force)
13991400
realpath = accelerator_orig_zend_resolve_path(filename);
14001401

14011402
if (!realpath) {
1402-
return FAILURE;
1403+
//file could have been deleted, but we still need to invalidate it.
1404+
//so instead of failing, just use the provided filename for the lookup
1405+
realpath = zend_string_copy(filename);
1406+
file_found = false;
14031407
}
14041408

14051409
if (ZCG(accel_directives).file_cache) {
@@ -1424,6 +1428,11 @@ zend_result zend_accel_invalidate(zend_string *filename, bool force)
14241428

14251429
file_handle.opened_path = NULL;
14261430
zend_destroy_file_handle(&file_handle);
1431+
} else if (!file_found) {
1432+
accelerator_shm_read_unlock();
1433+
zend_string_release_ex(realpath, 0);
1434+
1435+
return FAILURE;
14271436
}
14281437

14291438
accelerator_shm_read_unlock();

0 commit comments

Comments
 (0)