#41834 [Opn->Bgs]: pathinfo() parse a path like "/opt/" in wrong result
| From: | tony2001@php.net | Date: | Thu, 28 Jun 2007 08:17:15 +0000 |
| Subject: | #41834 [Opn->Bgs]: pathinfo() parse a path like "/opt/" in wrong result | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-114381@lists.php.net to get a copy of this message | ||
ID: 41834
Updated by: tony2001@php.net
Reported By: donyad at gmail dot com
-Status: Open
+Status: Bogus
Bug Type: URL related
Operating System: Window2000
PHP Version: 5.2.3
New Comment:
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
That's because "/opt/" is not a valid path on Win32.
Previous Comments:
------------------------------------------------------------------------
[2007-06-28 07:32:08] donyad at gmail dot com
Description:
------------
Use pathinfo() or basename() to parse a string "/opt/"
it will tell me the path is "\" and the filename is "opt"
Reproduce code:
---------------
<?php
parsePath("/opt/");
parsePath("/opt/file");
function parsePath($str) {
print("dirname:" . dirname($str) . "<br />\n");
print("basename:" . basename($str) . "<br />\n");
print("pathinfo:");
print_r(pathinfo($str));
print("<br /><br />\n");
}
?>
Expected result:
----------------
dirname:/opt
basename:
pathinfo:Array ( [dirname] => /opt [basename] => [filename] => )
dirname:/opt
basename:file
pathinfo:Array ( [dirname] => /opt [basename] => file [filename] =>
file )
even return the "/" as "\" is acceptable
dirname:\opt
basename:
pathinfo:Array ( [dirname] => \opt [basename] => [filename] => )
dirname:/opt
basename:file
pathinfo:Array ( [dirname] => /opt [basename] => file [filename] =>
file )
Actual result:
--------------
dirname:\
basename:opt
pathinfo:Array ( [dirname] => \ [basename] => opt [filename] => opt )
dirname:/opt
basename:file
pathinfo:Array ( [dirname] => /opt [basename] => file [filename] =>
file )
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=41834&edit=1