#36956 [NoF->Opn]: dirname returns \ for root /
| From: | e dot vandeoudeweetering at marcanti dot esprit-sg dot | Date: | Wed, 26 Apr 2006 11:13:31 +0000 |
| Subject: | #36956 [NoF->Opn]: dirname returns \ for root / | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-96258@lists.php.net to get a copy of this message | ||
ID: 36956
User updated by: e dot vandeoudeweetering at marcanti dot esprit-sg dot
Reported By: e dot vandeoudeweetering at marcanti dot esprit-sg dot
-Status: No Feedback
+Status: Open
Bug Type: Directory function related
Operating System: Windows 2000 (5.00.2195) SP4
PHP Version: 5.1.2
New Comment:
I used:
C:\phptemp>php -v
PHP 5.1.3RC4-dev (cli) (built: Apr 26 2006 12:19:43)
Copyright (c) 1997-2006 The PHP Group
Zend Engine v2.1.0, Copyright (c) 1998-2006 Zend Technologies
With the same result as before:
C:\phptemp>test.php
C:\Temp : C:\\Temp
C:/Temp : C:\/Temp
C:\ : C:\\C:
C:/ : C:\/C:
\\server\share : \\server\share
//server/share : //server/share
/usr/local : /usr/local
Previous Comments:
------------------------------------------------------------------------
[2006-04-18 01:00:01] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
------------------------------------------------------------------------
[2006-04-10 12:01:39] sniper@php.net
Please try using this CVS snapshot:
http://snaps.php.net/php5.1-latest.tar.gz
For Windows:
http://snaps.php.net/win32/php5.1-win32-latest.zip
------------------------------------------------------------------------
[2006-04-04 11:58:35] e dot vandeoudeweetering at marcanti dot
esprit-sg dot
I did check the following documentation:
http://nl3.php.net/manual/en/function.dirname.php
dirname('c:/');
it returns c:\ (notice the backslash)
the documentation says it should return c:
suggest the following 7 examles:
$dir = 'C:\\Temp';
print "$dir\t\t: ".dirname($dir).'\\'.basename($dir)."\n";
$dir = 'C:/Temp';
print "$dir\t\t: ".dirname($dir).'/'.basename($dir)."\n";
$dir = 'C:\\';
print "$dir\t\t: ".dirname($dir).'\\'.basename($dir)."\n";
$dir = 'C:/';
print "$dir\t\t: ".dirname($dir).'/'.basename($dir)."\n";
$dir = '\\\\server\\share';
print "$dir\t: ".dirname($dir).'\\'.basename($dir)."\n";
$dir = '//server/share';
print "$dir\t: ".dirname($dir).'/'.basename($dir)."\n";
$dir = '/usr/local';
print "$dir\t: ".dirname($dir).'/'.basename($dir)."\n";
The following output is generated:
C:\Temp : C:\\Temp
C:/Temp : C:\/Temp
C:\ : C:\\C:
C:/ : C:\/C:
\\server\share : \\server\share
//server/share : //server/share
/usr/local : /usr/local
The following output is expected:
C:\Temp : C:\Temp
C:/Temp : C:/Temp
C:\ : C:\
C:/ : C:/
\\server\share : \\server\share
//server/share : //server/share
/usr/local : /usr/local
As you see something is wrong!
------------------------------------------------------------------------
[2006-04-04 09:27:14] tony2001@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
This is expected, as Window$ uses \ everywhere instead of / on *nix.
------------------------------------------------------------------------
[2006-04-03 13:33:19] e dot vandeoudeweetering at marcanti dot
esprit-sg dot
Description:
------------
When using the function dirname, \ is returned for the root directory
/
This is what the documentation says:
//after PHP 4.3.0
dirname('c:/'); // returns 'c:'
Reproduce code:
---------------
print dirname('/');
print dirname('C:/');
print dirname('C:\\'); //this function works
Expected result:
----------------
/
C:
C:\
Actual result:
--------------
\
C:\
C:\
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=36956&edit=1