#51150 [NEW]: spl_autoload_extensions() should accept arrays to avoid invalid separators

From: Date: Thu, 25 Feb 2010 20:22:49 +0000
Subject: #51150 [NEW]: spl_autoload_extensions() should accept arrays to avoid invalid separators
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-148059@lists.php.net to get a copy of this message
From: jo at feuersee dot de Operating system: Any PHP version: 5.3.1 PHP Bug Type: SPL related Bug description: spl_autoload_extensions() should accept arrays to avoid invalid separators Description: ------------ spl_autoload_extensions() accepts a string with a , separated list of filename parts to register for autoloading. This results in filenames containing a , as an extension filename become impossible to register. It should be possible to pass an array to circumvent any restriction cased by the string based argument. I know that ppl might consider it strange to use , as part of a filename. IMHO there may be cases where it might be necessary. Considering that arrays are a native PHP data type, it would be a better design. Reproduce code: --------------- spl_autoload_extensions(array('.class.php', '.php')); myclass::hello(); Expected result: ---------------- Hello world Actual result: -------------- Warning: spl_autoload_extensions() expects parameter 1 to be string, array given in [test.php] on line ## Fatal error: Class 'myclass' not found in [test.php] on line ## -- Edit bug report at http://bugs.php.net/?id=51150&edit=1 -- Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=51150&r=trysnapshot52 Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=51150&r=trysnapshot53 Try a snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=51150&r=trysnapshot60 Fixed in SVN: http://bugs.php.net/fix.php?id=51150&r=fixed Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=51150&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=51150&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=51150&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=51150&r=needscript Try newer version: http://bugs.php.net/fix.php?id=51150&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=51150&r=support Expected behavior: http://bugs.php.net/fix.php?id=51150&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=51150&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=51150&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=51150&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=51150&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=51150&r=dst IIS Stability: http://bugs.php.net/fix.php?id=51150&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=51150&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=51150&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=51150&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=51150&r=mysqlcfg

« previous php.bugs (#148059) next »