Skip to content

Note that file_exists and the is_* access checks skip the stat cache for local files - #5997

Merged
lacatoire merged 1 commit into
php:masterfrom
qodelicious:access-checks-stat-cache
Oct 22, 2026
Merged

lacatoire merged 1 commit into
php:masterfrom
qodelicious:access-checks-stat-cache

Conversation

@qodelicious

Copy link
Copy Markdown
Contributor

file_exists(), is_readable(), is_writable() and is_executable() don't use the stat cache for local files. In php_stat() these four go straight to access() when the path uses the plain files wrapper, so they never read from or write to the cache. Only paths using other wrappers go through url_stat and get cached.

  • Replaced the generic "results of this function are cached" note on those four pages with a note that says local files are checked every time and other wrappers are cached. It lives in a new reference/filesystem/entities.ent so all four pages share it.
  • On the clearstatcache() page, the example about non-existent files used file_exists(), which doesn't behave like that for local files. Switched it to is_file(), which does. Also added a line under the affected functions list about the four access checks.

Fixes #4572

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] file_exists, is_readable and is_writable do not use stat cache

2 participants