Req #67701 [Opn->Ver]: space in comma separated extensions list in spl_autoload_extensions()

From: Date: Mon, 18 Jun 2018 12:25:32 +0000
Subject: Req #67701 [Opn->Ver]: space in comma separated extensions list in spl_autoload_extensions()
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-215771@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=67701&edit=1 ID: 67701 Updated by: cmb@php.net Reported by: fafnir2201 at gmail dot com Summary: space in comma separated extensions list in spl_autoload_extensions() -Status: Open +Status: Verified Type: Feature/Change Request Package: SPL related Operating System: Ubuntu 14.04 PHP Version: 5.5.15 Block user comment: N Private report: N New Comment: 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. Previous Comments: ------------------------------------------------------------------------ [2014-07-28 20:49:40] fafnir2201 at gmail dot com 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 this bug report at https://bugs.php.net/bug.php?id=67701&edit=1

« previous php.bugs (#215771) next »