| 
        php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | 
  [2005-04-07 18:23 UTC] alan dot harder at sun dot com
 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). PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits             
             | 
    |||||||||||||||||||||||||||||||||||||
            
                 
                Copyright © 2001-2025 The PHP GroupAll rights reserved.  | 
        Last updated: Tue Nov 04 04:00:01 2025 UTC | 
This is not fixed at all... This is a documentation bug... realpath() uses the underlying system realpath() { unless you run it with the hardening-patch } On linux/glibc realpath() will return failure if the last component does not exist. On BSD realpath() will not return failure if only the last component does not exist.