#32162 [Fbk->NoF]: dirname returning \ for root entries
| From: | sniper@php.net | Date: | Sun, 20 Mar 2005 17:11:23 +0000 |
| Subject: | #32162 [Fbk->NoF]: dirname returning \ for root entries | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-75608@lists.php.net to get a copy of this message | ||
ID: 32162
Updated by: sniper@php.net
Reported By: paul at wavebreaks dot com
-Status: Feedback
+Status: No Feedback
Bug Type: Directory function related
Operating System: Windows XP SP2
PHP Version: 5.0.3
New Comment:
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.
Previous Comments:
------------------------------------------------------------------------
[2005-03-06 16:26:36] sniper@php.net
Please try using this CVS snapshot:
http://snaps.php.net/php5-latest.tar.gz
For Windows:
http://snaps.php.net/win32/php5-win32-latest.zip
------------------------------------------------------------------------
[2005-03-02 08:21:05] paul at wavebreaks dot com
Description:
------------
This is probably the same or related to
http://bugs.php.net/bug.php?id=25450 and
http://bugs.php.net/bug.php?id=18710 but since
they are for Win 2k
and/or closed, I thought the best bet was to open a new one.
When a path-like-string is passed to dirname, if, and only if, the last
entity (file, dir) is on the root (ie: only one / in the string) then
dirname returns a backslash instead of a forward slash.
There doesn't appear to be a config to tell PHP which part seperator to
use, thus the dirname function is pointlessly broken unless you can
guarentee it will never be given a root level entry.
This, also, breaks your example in the documentation for header() for
Location: header types.
Reproduce code:
---------------
print (dirname('/foo')."\n");
print (dirname('/foo/bar')."\n");
Expected result:
----------------
/
/foo
Actual result:
--------------
\
/foo
You might argue it's not a bug since Windows is meant to handle both
types of path seperator, but a URI does not, and this is you main
audience.
This issue has been around for way past way too long.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=32162&edit=1