xref: /PHP-8.1/tests/classes/autoload_006.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    require_once(__DIR__ . '/' . strtolower($class_name) . '.inc');
12    echo 'autoload(' . $class_name . ")\n";
13});
14
15var_dump(interface_exists('autoload_interface', false));
16var_dump(class_exists('autoload_implements', false));
17
18$o = new Autoload_Implements;
19var_dump($o);
20var_dump($o instanceof autoload_interface);
21unset($o);
22
23var_dump(interface_exists('autoload_interface', false));
24var_dump(class_exists('autoload_implements', false));
25
26?>
27--EXPECTF--
28bool(false)
29bool(false)
30autoload(autoload_interface)
31autoload(Autoload_Implements)
32object(autoload_implements)#%d (0) {
33}
34bool(true)
35bool(true)
36bool(true)
37