#21755 [Opn->Bgs]: dirname(), basename(), pathinfo() not working for Windows filenames

From: Date: Sun, 19 Jan 2003 23:44:48 +0000
Subject: #21755 [Opn->Bgs]: dirname(), basename(), pathinfo() not working for Windows filenames
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-30593@lists.php.net to get a copy of this message
ID: 21755 Updated by: iliaa@php.net Reported By: k.schroeder@php.net -Status: Open +Status: Bogus Bug Type: *Directory/Filesystem functions Operating System: Linux PHP Version: 4.3.0 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 On *nix \ is not a directory separator. Previous Comments: ------------------------------------------------------------------------ [2003-01-19 13:33:08] k.schroeder@php.net 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 this bug report at http://bugs.php.net/?id=21755&edit=1

« previous php.bugs (#30593) next »