Req #67701 [NEW]: space in comma separated extensions list in spl_autoload_extensions()

From: Date: Mon, 28 Jul 2014 20:49:41 +0000
Subject: Req #67701 [NEW]: space in comma separated extensions list in spl_autoload_extensions()
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-186847@lists.php.net to get a copy of this message
From: fafnir2201 at gmail dot com Operating system: Ubuntu 14.04 PHP version: 5.5.15 Package: SPL related Bug Type: Feature/Change Request Bug description:space in comma separated extensions list in spl_autoload_extensions() Description: ------------ --- From manual page: http://www.php.net/function.spl-autoload-extensions --- 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: <?php namespace system; class test { public static function alert() { echo "test"; } } ?> file project/index.php: <?php spl_autoload_extensions('.php, .class.php'); spl_autoload_register(); system\test::alert(); ?> Expected result: ---------------- test 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 -- Edit bug report at https://bugs.php.net/bug.php?id=67701&edit=1 --

« previous php.bugs (#186847) next »