ID: 39313 Updated by: [EMAIL PROTECTED] Reported By: justin dot foell at sellingsource dot com -Status: Open +Status: Bogus Bug Type: SPL related Operating System: Gentoo Linux PHP Version: 5.1.6 New Comment:
Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php The order is respected as you described. But if you are using a non existing class the __autoload facility starts its work. And that means spl's autoload stuff is being invoked. That then calls all registered autoload functions one after another. And only if all fail you get an error, where the error is generated from the spl autoload handling system and send to the engine's autoload facility. Previous Comments: ------------------------------------------------------------------------ [2006-10-31 00:27:44] justin dot foell at sellingsource dot com Description: ------------ If the default spl_autoload function is at the top of the stack and the class is not found, a Fatal error is triggered. I would think you would want to fail silently, that way the fast C code can be used first, then fall-back to your custom PHP Code. Then if the class is still not found, let PHP deal with it. The following code will work if the two spl_autoload_register lines are switched. Reproduce code: --------------- <?php //MyClass.php class MyClass { public function __construct() { echo __CLASS__, "\n"; } } ?> <?php //test.php function myloader($class_name) { return @include_once($class_name . ".php"); } spl_autoload_register('spl_autoload'); spl_autoload_register('myloader'); print_r(spl_autoload_functions()); $myclass = new MyClass(); ?> Expected result: ---------------- Array ( [0] => spl_autoload [1] => myloader ) MyClass Actual result: -------------- Array ( [0] => spl_autoload [1] => myloader ) Fatal error: Class 'MyClass' not found in /virtualhosts/justin/test/test.php on line 12 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=39313&edit=1