# AW:  file_exists() and safe_mode

- Thread: https://externals.io/message/25529
- Original archive: https://news-web.php.net/php.internals/25529
- Started by Matthias Pigulla on 2006-09-05T15:45:04+00:00
- Messages: 2
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #25529 — Matthias Pigulla — 2006-09-05T15:45:04+00:00

URL: https://externals.io/message/25529#25529

> I think the current  behavior solves made old bug reports, 
> where by people used `is_readable()` to see if they could read 
> from a file, only to have the operation file due to 
> safe_mode/open_basedir restrictions. Taking the check away 
> would also mean it would be possible to "explore" file file 
> system bypassing PHP's file system restrictions.
 
So this is a documentation bug and there is no way to check beforehand
whether an include($filepath) will succeed or not when safe_mode is on?

Kind regards
mp.

---

## #25532 — Ilia Alshanetsky — 2006-09-05T15:54:07+00:00

URL: https://externals.io/message/25529#25532 · In reply to: #25529

> So this is a documentation bug and there is no way to check beforehand
> whether an include($filepath) will succeed or not when safe_mode is  
> on?

Now there is (because of the change), before there was none. Do the  
check before, you'd need to open the file with @fopen(), see if that  
failed and if it not, then you know for certain you can work with the  
file.

Ilia Alshanetsky
