xref: /PHP-7.2/Zend/tests/bug49908.phpt (revision 22ed3628)
1--TEST--
2Bug #49908 (throwing exception in __autoload crashes when interface is not defined)
3--FILE--
4<?php
5
6spl_autoload_register(function ($className) {
7	var_dump($className);
8
9	if ($className == 'Foo') {
10		class Foo implements Bar {};
11	} else {
12		throw new Exception($className);
13	}
14});
15
16new Foo;
17
18?>
19--EXPECTF--
20string(3) "Foo"
21string(3) "Bar"
22
23Fatal error: Uncaught Exception: Bar in %s:%d
24Stack trace:
25#0 [internal function]: {closure}('Bar')
26#1 %s(%d): spl_autoload_call('Bar')
27#2 [internal function]: {closure}('Foo')
28#3 %s(%d): spl_autoload_call('Foo')
29#4 {main}
30  thrown in %s on line %d
31