Annotation of embedaddon/php/ext/spl/tests/spl_autoload_012.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: SPL: spl_autoload() capturing multiple Exceptions in __autoload
3: --FILE--
4: <?php
5:
6: function autoload_first($name)
7: {
8: echo __METHOD__ . "\n";
9: throw new Exception('first');
10: }
11:
12: function autoload_second($name)
13: {
14: echo __METHOD__ . "\n";
15: throw new Exception('second');
16: }
17:
18: spl_autoload_register('autoload_first');
19: spl_autoload_register('autoload_second');
20:
21: try {
22: class_exists('ThisClassDoesNotExist');
23: } catch(Exception $e) {
24: do {
25: echo $e->getMessage()."\n";
26: } while($e = $e->getPrevious());
27: }
28:
29: try {
30: new ThisClassDoesNotExist;
31: } catch(Exception $e) {
32: do {
33: echo $e->getMessage()."\n";
34: } while($e = $e->getPrevious());
35: }
36:
37: class_exists('ThisClassDoesNotExist');
38: ?>
39: ===DONE===
40: --EXPECTF--
41: autoload_first
42: autoload_second
43: second
44: first
45: autoload_first
46: autoload_second
47: second
48: first
49: autoload_first
50: autoload_second
51:
52: Fatal error: Uncaught exception 'Exception' with message 'first' in %sspl_autoload_012.php:%d
53: Stack trace:
54: #0 [internal function]: autoload_first('ThisClassDoesNo...')
55: #1 [internal function]: spl_autoload_call('ThisClassDoesNo...')
56: #2 %sspl_autoload_012.php(%d): class_exists('ThisClassDoesNo...')
57: #3 {main}
58:
59: Next exception 'Exception' with message 'second' in %sspl_autoload_012.php:%d
60: Stack trace:
61: #0 [internal function]: autoload_second('ThisClassDoesNo...')
62: #1 [internal function]: spl_autoload_call('ThisClassDoesNo...')
63: #2 %sspl_autoload_012.php(%d): class_exists('ThisClassDoesNo...')
64: #3 {main}
65: thrown in %sspl_autoload_012.php on line %d
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>