1--TEST-- 2SPL: spl_autoload() capturing multiple Exceptions in __autoload 3--FILE-- 4<?php 5 6function autoload_first($name) 7{ 8 echo __METHOD__ . "\n"; 9 throw new Exception('first'); 10} 11 12function autoload_second($name) 13{ 14 echo __METHOD__ . "\n"; 15 throw new Exception('second'); 16} 17 18spl_autoload_register('autoload_first'); 19spl_autoload_register('autoload_second'); 20 21try { 22 class_exists('ThisClassDoesNotExist'); 23} catch(Exception $e) { 24 do { 25 echo $e->getMessage()."\n"; 26 } while($e = $e->getPrevious()); 27} 28 29try { 30 new ThisClassDoesNotExist; 31} catch(Exception $e) { 32 do { 33 echo $e->getMessage()."\n"; 34 } while($e = $e->getPrevious()); 35} 36 37class_exists('ThisClassDoesNotExist'); 38?> 39===DONE=== 40--EXPECTF-- 41autoload_first 42first 43autoload_first 44first 45autoload_first 46 47Fatal error: Uncaught Exception: first in %sspl_autoload_012.php:%d 48Stack trace: 49#0 [internal function]: autoload_first('ThisClassDoesNo...') 50#1 [internal function]: spl_autoload_call('ThisClassDoesNo...') 51#2 %sspl_autoload_012.php(%d): class_exists('ThisClassDoesNo...') 52#3 {main} 53 thrown in %s on line %d 54