|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2007-05-02 19:34 UTC] tim at gerundt dot de
Description:
------------
If I try to get the "dirname" from the pathinfo() function under Windows with a path like "/index.php", I get "\" instead of "/" as dirname value. Under Linux I get the desired value ("/").
I tested it with PHP 5.2.1 (Apache 2.2.4, Windows XP) and PHP 4.4.6 (Apache 2.0.54, Windows 2000).
Greetings,
Tim Gerundt
Reproduce code:
---------------
<?php
$pathinfo = pathinfo('/index.php');
print_r($pathinfo);
?>
Expected result:
----------------
Array
(
[dirname] => /
[basename] => index.php
[extension] => php
)
Actual result:
--------------
Array
(
[dirname] => \
[basename] => index.php
[extension] => php
)
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Dec 03 01:00:01 2025 UTC |
And why is this not a bug? The dirname from (the string) "/index.php" is "/" regardless of I call the function under Windows or Linux. If I use a path string with a sub directory (like "/test/index.php") even Windows returns the correct dirname ("/test"). The problem exist only on Windows when a (unix/web) path includes no sub directories.