xref: /PHP-8.3/tests/classes/autoload_005.phpt (revision c5401854)
1--TEST--
2ZE2 Autoload from destructor
3--SKIPIF--
4<?php
5    if (class_exists('autoload_root', false)) die('skip Autoload test classes exist already');
6?>
7--FILE--
8<?php
9
10spl_autoload_register(function ($class_name) {
11    var_dump(class_exists($class_name, false));
12    require_once(__DIR__ . '/' . $class_name . '.inc');
13    echo 'autoload(' . $class_name . ")\n";
14});
15
16var_dump(class_exists('autoload_derived', false));
17var_dump(class_exists('autoload_derived', false));
18
19class Test
20{
21    function __destruct() {
22        echo __METHOD__ . "\n";
23        $o = new autoload_derived;
24        var_dump($o);
25    }
26}
27
28$o = new Test;
29unset($o);
30
31?>
32--EXPECTF--
33bool(false)
34bool(false)
35Test::__destruct
36bool(false)
37bool(false)
38autoload(autoload_root)
39autoload(autoload_derived)
40object(autoload_derived)#%d (0) {
41}
42