From:
Operating system: Any
PHP version: 5.3.10
Package: *General Issues
Bug Type: Feature/Change Request
Bug description:Slash agnostic basename()
Description:
------------
On Windows, basename() works with \ or /. On Unix platforms it only works
with /.
Since / is technically wrong on Windows, it should let you be technically
wrong on
Unix using \. Why? I noticed this while working on a custom autoloader. I
was
trying to basename('namespace\class') and was getting back
'namespace\class' on
Unix but only getting 'class' on Windows, and 'class' was the expected
output.
Since namespaces use a pseudo-filesystem structure I believe basename()
(and
probably dirname()) should be allowed to work properly on them regardless
of the
OS.
"But you are't dealing with files so this is dumb" - when it comes to
autoloading,
namespaces and classes are dealing with files... so.
Test script:
---------------
<?php
// on unix vs on windows
spl_autoload_register(function($name){
var_dump(basename($name));
die();
});
new bob\ftw;
?>
Expected result:
----------------
'ftw'
Actual result:
--------------
'bob\ftw' on unix.
--
Edit bug report at https://bugs.php.net/bug.php?id=60996&edit=1
--
Try a snapshot (PHP 5.4):
https://bugs.php.net/fix.php?id=60996&r=trysnapshot54
Try a snapshot (PHP 5.3):
https://bugs.php.net/fix.php?id=60996&r=trysnapshot53
Try a snapshot (trunk):
https://bugs.php.net/fix.php?id=60996&r=trysnapshottrunk
Fixed in SVN:
https://bugs.php.net/fix.php?id=60996&r=fixed
Fixed in SVN and need be documented:
https://bugs.php.net/fix.php?id=60996&r=needdocs
Fixed in release:
https://bugs.php.net/fix.php?id=60996&r=alreadyfixed
Need backtrace:
https://bugs.php.net/fix.php?id=60996&r=needtrace
Need Reproduce Script:
https://bugs.php.net/fix.php?id=60996&r=needscript
Try newer version:
https://bugs.php.net/fix.php?id=60996&r=oldversion
Not developer issue:
https://bugs.php.net/fix.php?id=60996&r=support
Expected behavior:
https://bugs.php.net/fix.php?id=60996&r=notwrong
Not enough info:
https://bugs.php.net/fix.php?id=60996&r=notenoughinfo
Submitted twice:
https://bugs.php.net/fix.php?id=60996&r=submittedtwice
register_globals:
https://bugs.php.net/fix.php?id=60996&r=globals
PHP 4 support discontinued:
https://bugs.php.net/fix.php?id=60996&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=60996&r=dst
IIS Stability:
https://bugs.php.net/fix.php?id=60996&r=isapi
Install GNU Sed:
https://bugs.php.net/fix.php?id=60996&r=gnused
Floating point limitations:
https://bugs.php.net/fix.php?id=60996&r=float
No Zend Extensions:
https://bugs.php.net/fix.php?id=60996&r=nozend
MySQL Configuration Error:
https://bugs.php.net/fix.php?id=60996&r=mysqlcfg