#37987 [NEW]: invalid return of file_exists() in safe mode
| From: | tokul at users dot sourceforge dot net | Date: | Sun, 02 Jul 2006 13:31:25 +0000 |
| Subject: | #37987 [NEW]: invalid return of file_exists() in safe mode | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-99031@lists.php.net to get a copy of this message | ||
From: tokul at users dot sourceforge dot net
Operating system:
PHP version: 5.1.4
PHP Bug Type: Filesystem function related
Bug description: invalid return of file_exists() in safe mode
Description:
------------
PHP documentation (http://www.php.net/file-exists) states that
file_exists() function returns false, when file is inaccessible due to
safe mode restrictions.
Tested PHP 4.3.10, 4.4CVS (200607021030), 5.1.4 and 5.2CVS(200607021030).
In PHP 5.1.4 and 5.2CVS file_exists() function returns true, when file
exists, but is inaccessible due to safe mode restrictions. Other php
versions work as documented.
Reproduce code:
---------------
<?php
var_dump(ini_get('safe_mode'));
var_dump(file_exists('/usr/games/fortune'));
var_dump(is_file('/usr/games/fortune'));
var_dump(is_dir('/usr/games/fortune'));
?>
Expected result:
----------------
When safe_mode is on
----
string(1) "1"
bool(false)
bool(false)
bool(false)
----
When safe_mode is off
----
string(0) ""
bool(true)
bool(true)
bool(false)
----
Actual result:
--------------
When safe_mode is on
----
string(1) "1"
bool(true)
bool(false)
bool(false)
----
When safe_mode is off
----
string(0) ""
bool(true)
bool(true)
bool(false)
----
--
Edit bug report at http://bugs.php.net/?id=37987&edit=1
--
Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=37987&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=37987&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=37987&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=37987&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=37987&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=37987&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=37987&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=37987&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=37987&r=support
Expected behavior: http://bugs.php.net/fix.php?id=37987&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=37987&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=37987&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=37987&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=37987&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=37987&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=37987&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=37987&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=37987&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=37987&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=37987&r=mysqlcfg