php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #32627 realpath fails to return FALSE if last path component does not exist
Submitted: 2005-04-07 18:23 UTC Modified: 2005-08-07 14:52 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: alan dot harder at sun dot com Assigned:
Status: Closed Package: Documentation problem
PHP Version: 4.3.10 OS: FreeBSD 4.11-STABLE
Private report: No CVE-ID: None
 [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).

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-04-07 21:04 UTC] sniper@php.net
Thank you for your bug report. This issue has already been fixed
in the latest released version of PHP, which you can download at 
http://www.php.net/downloads.php


 [2005-04-07 21:42 UTC] alan dot harder at sun dot com
thanks for the response.  by "latest" do you mean php5?  as shown in this bug description I tested with today's stable 4.3.x build in addition to 4.3.10 where i found the problem.
 [2005-04-07 23:44 UTC] sesser@php.net
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.


 [2005-08-07 14:52 UTC] nlopess@php.net
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.

Thank you for the report, and for helping us make our documentation better.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Dec 22 19:01:31 2024 UTC