file_exists() and safe_mode
| From: | Matthias Pigulla | Date: | Tue, 05 Sep 2006 14:58:33 +0000 |
| Subject: | file_exists() and safe_mode | ||
| Groups: | php.internals | ||
| Request: | Send a blank email to internals+get-25527@lists.php.net to get a copy of this message | ||
Hi all,
I'm afraid that recent changes in filestat.c [1] that were meant to fix
a bug [2] with file_exists() also altered the behaviour of
is_readable(). According to the docs [3] [4], is_readable should *not*
take safe_mode limitations into account, whereas file_exists should do.
<?php
print PHP_VERSION . "\n";
var_dump(ini_get('safe_mode'));
var_dump(file_exists('/etc/hosts'));
var_dump(is_readable('/etc/hosts'));
?>
mp@dev:~$ php bug.php
5.1.6
string(0) ""
bool(true)
bool(true)
mp@dev:~$ php -d safe_mode=1 bug.php
5.1.6
string(1) "1"
bool(false)
bool(false)
Is this intended behaviour? If not, I'd be glad to file it as a bug.
Kind regards,
mp.
[1] http://cvs.php.net/viewvc.cgi/php-src/ext/standard/filestat.c
[2] http://bugs.php.net/bug.php?id=37987
[3] http://de2.php.net/manual/en/function.is-readable.php
[4] http://de2.php.net/manual/en/function.file-exists.php