xref: /PHP-8.0/Zend/tests/bug63741.phpt (revision 26dfce7f)
1--TEST--
2Bug #63741 (Crash when autoloading from spl)
3--FILE--
4<?php
5file_put_contents(__DIR__."/bug63741.tmp.php",
6<<<'EOT'
7<?php
8if (isset($autoloading))
9{
10    class ClassToLoad
11    {
12        static function func ()
13        {
14            print "OK!\n";
15        }
16    }
17    return;
18}
19else
20{
21    class autoloader
22    {
23        static function autoload($classname)
24        {
25            print "autoloading...\n";
26            $autoloading = true;
27            include __FILE__;
28        }
29    }
30
31    spl_autoload_register(["autoloader", "autoload"]);
32
33    function start()
34    {
35        ClassToLoad::func();
36    }
37
38    start();
39}
40?>
41EOT
42);
43
44include __DIR__."/bug63741.tmp.php";
45?>
46--CLEAN--
47<?php unlink(__DIR__."/bug63741.tmp.php"); ?>
48--EXPECT--
49autoloading...
50OK!
51