From: paul at wavebreaks dot com Operating system: Windows XP SP2 PHP version: 5.0.3 PHP Bug Type: Directory function related Bug description: dirname returning \ for root entries
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 bug report at http://bugs.php.net/?id=32162&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=32162&r=trysnapshot4 Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=32162&r=trysnapshot50 Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=32162&r=trysnapshot51 Fixed in CVS: http://bugs.php.net/fix.php?id=32162&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=32162&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=32162&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=32162&r=needscript Try newer version: http://bugs.php.net/fix.php?id=32162&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=32162&r=support Expected behavior: http://bugs.php.net/fix.php?id=32162&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=32162&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=32162&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=32162&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=32162&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=32162&r=dst IIS Stability: http://bugs.php.net/fix.php?id=32162&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=32162&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=32162&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=32162&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=32162&r=mysqlcfg