From:             [EMAIL PROTECTED]
Operating system: Linux
PHP version:      4.3.0
PHP Bug Type:     *Directory/Filesystem functions
Bug description:  dirname(), basename(), pathinfo() not working for Windows filenames

test script:
<?php
// windows
$path_win = 'C:\WINNT\anything.txt';
echo "\n".'dirname("'.$path_win.'"):'."\n";
var_dump(dirname($path_win));
echo "\n".'basename("'.$path_win.'"):'."\n";
var_dump(basename($path_win));
echo "\n".'pathinfo("'.$path_win.'"):'."\n";
var_dump(pathinfo($path_win));

// *nix
$path_nix = '/etc/anything.conf';
echo "\n".'dirname("'.$path_nix.'"):'."\n";
var_dump(dirname($path_nix));
echo "\n".'basename("'.$path_nix.'"):'."\n";
var_dump(basename($path_nix));
echo "\n".'pathinfo("'.$path_nix.'"):'."\n";
var_dump(pathinfo($path_nix));
?>

output:

dirname("C:\WINNT\anything.txt"):
string(1) "."

basename("C:\WINNT\anything.txt"):
string(21) "C:\WINNT\anything.txt"

pathinfo("C:\WINNT\anything.txt"):
array(3) {
  ["dirname"]=>
  string(1) "."
  ["basename"]=>
  string(21) "C:\WINNT\anything.txt"
  ["extension"]=>
  string(3) "txt"
}

dirname("/etc/anything.conf"):
string(4) "/etc"

basename("/etc/anything.conf"):
string(13) "anything.conf"

pathinfo("/etc/anything.conf"):
array(3) {
  ["dirname"]=>
  string(4) "/etc"
  ["basename"]=>
  string(13) "anything.conf"
  ["extension"]=>
  string(4) "conf"
}
-- 
Edit bug report at http://bugs.php.net/?id=21755&edit=1
-- 
Try a CVS snapshot:         http://bugs.php.net/fix.php?id=21755&r=trysnapshot
Fixed in CVS:               http://bugs.php.net/fix.php?id=21755&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=21755&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=21755&r=needtrace
Try newer version:          http://bugs.php.net/fix.php?id=21755&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=21755&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=21755&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=21755&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=21755&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=21755&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=21755&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=21755&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=21755&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=21755&r=gnused

Reply via email to