|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2010-02-25 20:22 UTC] jo at feuersee dot de
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 ##
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Oct 30 04:00:02 2025 UTC |
Using implode() would really be enough here, I'm not sure whether we should add that option or not, but it is indeed not a bad idea. As a workaround you may want to do: spl_autoload_extensions(implode(',', $extensions));