#32627 [Csd]: realpath fails to return FALSE if last path component does not exist

2005-04-07 Thread sesser
 ID:   32627
 Updated by:   [EMAIL PROTECTED]
 Reported By:  alan dot harder at sun dot com
 Status:   Closed
 Bug Type: Filesystem function related
 Operating System: FreeBSD 4.11-STABLE
 PHP Version:  4.3.10
 New Comment:

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.




Previous Comments:


[2005-04-07 21:42:39] 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 21:04:46] [EMAIL PROTECTED]

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 18:23:45] 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).





-- 
Edit this bug report at http://bugs.php.net/?id=32627&edit=1


#32627 [Csd]: realpath fails to return FALSE if last path component does not exist

2005-04-07 Thread alan dot harder at sun dot com
 ID:   32627
 User updated by:  alan dot harder at sun dot com
 Reported By:  alan dot harder at sun dot com
 Status:   Closed
 Bug Type: Filesystem function related
 Operating System: FreeBSD 4.11-STABLE
 PHP Version:  4.3.10
 New Comment:

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.


Previous Comments:


[2005-04-07 21:04:46] [EMAIL PROTECTED]

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 18:23:45] 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).





-- 
Edit this bug report at http://bugs.php.net/?id=32627&edit=1