#32627 [NEW]: realpath fails to return FALSE if last path component does not exist
From: alan dot harder at sun dot com
Operating system: FreeBSD 4.11-STABLE
PHP version: 4.3.10
PHP Bug Type: *Directory/Filesystem functions
Bug description: realpath fails to return FALSE if last path component does not exist
Description:
------------
I have found that realpath() returns a path when it should return FALSE if
only the last path component in the given string does not exist. Tested on
php 4.3.10 and php4-STABLE-200504071438. Both tests and phpinfo can be
viewed at http://realpath.moshpit.org/
Reproduce code:
---------------
$x = realpath('/bad/path'); var_dump($x);
$x = realpath('/badpath'); var_dump($x);
$x = realpath('/tmp/badpath'); var_dump($x);
View tests at http://realpath.moshpit.org/
Expected result:
----------------
FALSE for all three tests.
Actual result:
--------------
The first one works (gets FALSE), the other two return the path when they
should return FALSE (assuming /tmp is valid).
--
Edit bug report at http://bugs.php.net/?id=32627&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=32627&r=trysnapshot4
Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=32627&r=trysnapshot50
Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=32627&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=32627&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=32627&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=32627&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=32627&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=32627&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=32627&r=support
Expected behavior: http://bugs.php.net/fix.php?id=32627&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=32627&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=32627&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=32627&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=32627&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=32627&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=32627&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=32627&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=32627&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=32627&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=32627&r=mysqlcfg
Thread (1 message)
- alan dot harder at sun dot com