#48548 [NEW]: file_exists() returns false on paths using ../ in middle
From: adam at e-nition dot com
Operating system: Linux
PHP version: 5.2.9
PHP Bug Type: Scripting Engine problem
Bug description: file_exists() returns false on paths using ../ in middle
Description:
------------
The file_exists() function returns false on files that do exist but use a
directory traversal in the path. Not at the start of the path, I mean in
the middle of the path. (This type of path works fine on the include
function)
Works fine on windows apache2.2.11 php5.2.9
Reproduce code:
---------------
(Example based on a file called 'real_file.php' being placed in a
directory called 'real_dir')
$test_path = 'real_dir/fake_dir/../real_file.php',
if (file_exists($test_path)) {
echo 'File does exist<br />';
echo (@include($test_path)) ? 'File included' : 'File NOT included';
} else {
echo 'File does Not exist<br />';
echo (@include($test_path)) ? 'File included' : 'File NOT included';
}
Expected result:
----------------
File does exist
File included
Actual result:
--------------
File does NOT exist
File included
--
Edit bug report at http://bugs.php.net/?id=48548&edit=1
--
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=48548&r=trysnapshot52
Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=48548&r=trysnapshot53
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=48548&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=48548&r=fixedcvs
Fixed in CVS and need be documented: http://bugs.php.net/fix.php?id=48548&r=needdocs
Fixed in release: http://bugs.php.net/fix.php?id=48548&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=48548&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=48548&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=48548&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=48548&r=support
Expected behavior: http://bugs.php.net/fix.php?id=48548&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=48548&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=48548&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=48548&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=48548&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=48548&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=48548&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=48548&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=48548&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=48548&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=48548&r=mysqlcfg
Thread (4 messages)
- adam at e-nition dot com