xref: /php-src/ext/spl/tests/bug73896.phpt (revision d30cd7d7)
1--TEST--
2Bug #73896 (spl_autoload() crashes when calls magic _call())
3--FILE--
4<?php
5class Registrator {
6    public static function call($callable, array  $args) {
7        return call_user_func_array($callable, [$args]);
8    }
9}
10
11class teLoader {
12    public function __construct() {
13        Registrator::call('spl_autoload_register', [$this, 'autoload']);
14    }
15
16    public function __call($method, $args) {
17        $this->doSomething();
18    }
19
20    protected function autoload($class) {
21        die("Protected autoload() called!\n");
22    }
23
24    public function doSomething() {
25        throw new teException();
26    }
27}
28
29$teLoader = new teLoader();
30
31try {
32    new teChild();
33} catch (Throwable $e) {
34    echo "Exception: ", $e->getMessage() , "\n";
35}
36?>
37--EXPECT--
38Exception: Class "teException" not found
39