|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2008-09-15 10:21 UTC] colder@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Dec 03 06:00:02 2025 UTC |
Description: ------------ If spl_autoload() is triggered by class_exists() it is able to handle occuring exceptions but if it is triggered through "new .." then exceptions are silently ignored. Attached is an adapted copy of spl_autoload_012.phpt. Reproduce code: --------------- --TEST-- SPL: spl_autoload() capturing multiple Exceptions in __autoload --FILE-- <?php function autoload_first($name) { echo __METHOD__ . "\n"; throw new Exception('first'); } function autoload_second($name) { echo __METHOD__ . "\n"; throw new Exception('second'); } spl_autoload_register('autoload_first'); spl_autoload_register('autoload_second'); new ThisClassDoesNotExist; ?> ===DONE=== --EXPECTF-- autoload_first autoload_second Fatal error: Uncaught exception 'Exception' with message 'first' in %sspl_autoload_013.php:%d Stack trace: #0 [internal function]: autoload_first('ThisClassDoesNo...') #1 [internal function]: spl_autoload_call('ThisClassDoesNo...') #2 %sspl_autoload_013.php(%d): class_exists('ThisClassDoesNo...') #3 {main} Next exception 'Exception' with message 'second' in %sspl_autoload_013.php:%d Stack trace: #0 [internal function]: autoload_second('ThisClassDoesNo...') #1 [internal function]: spl_autoload_call('ThisClassDoesNo...') #2 %sspl_autoload_013.php(%d): class_exists('ThisClassDoesNo...') #3 {main} thrown in %sspl_autoload_013.php on line %d Actual result: -------------- autoload_first autoload_second PHP Fatal error: Class 'ThisClassDoesNotExist' not found in ... on line 0 Fatal error: Class 'ThisClassDoesNotExist' not found in ... on line 0