|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #67701 space in comma separated extensions list in spl_autoload_extensions()
Submitted: 2014-07-28 20:49 UTC Modified: 2019-05-15 11:59 UTC
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:0 (0.0%)
From: fafnir2201 at gmail dot com Assigned: peehaa (profile)
Status: Closed Package: SPL related
PHP Version: 5.5.15 OS: Ubuntu 14.04
Private report: No CVE-ID: None
 [2014-07-28 20:49 UTC] fafnir2201 at gmail dot com
From manual page:
I try to register extensions with spl_autoload_extensions(). Extensions list contains space after comma in string i.e. ".php, .class.php". For autoloading I use spl_autoload_register() without parameters. This scheme doesn't work until I'll remove space from extensions list (i.e. ".php,.class.php"). I guess it should be better to trim spaces after separating string with extensions or add notice about this feature to the documentation.

Test script:
file project/system/test.class.php:
namespace system;
class test {
public static function alert() {
echo "test";
} } ?>

file project/index.php:
spl_autoload_extensions('.php, .class.php');

Expected result:

Actual result:
Fatal error: Uncaught exception 'LogicException' with message 'Class system\test could not be loaded' in /var/www/project/index.php:4 Stack trace: #0 /var/www/project/index.php(4): spl_autoload('system\test') #1 {main} thrown in /var/www/project/index.php on line 4


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2018-06-18 12:25 UTC]
-Status: Open +Status: Verified
 [2018-06-18 12:25 UTC]
Changing to doc problem.  If you prefer to actually change the
behavior of spl_autoload_extensions() in this regard, please
provide a pull request or start a discussion on the internals@
mailing list.
 [2018-06-18 12:25 UTC]
-Type: Feature/Change Request +Type: Documentation Problem
 [2019-05-15 11:57 UTC]
Automatic comment from SVN on behalf of peehaa
Log: Added example and a note to make it clear to not use a space character between file extensions in the list. Closes #67701
 [2019-05-15 11:59 UTC]
-Status: Verified +Status: Closed -Assigned To: +Assigned To: peehaa
 [2019-05-15 11:59 UTC]
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.

Thank you for the report, and for helping us make our documentation better.
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Tue Nov 24 13:01:23 2020 UTC