xref: /PHP-8.1/Zend/tests/is_a.phpt (revision f8d79582)
1--TEST--
2is_a() and is_subclass_of() shouldn't call autoloader
3--INI--
4error_reporting=14335
5--FILE--
6<?php
7spl_autoload_register(function ($name) {
8    echo("AUTOLOAD '$name'\n");
9    eval("class $name {}");
10});
11
12class BASE {
13}
14
15interface I {
16}
17
18class A extends BASE implements I {
19}
20
21$a = new A;
22var_dump(is_a($a, "B1"));
23var_dump(is_a($a, "A"));
24var_dump(is_a($a, "BASE"));
25var_dump(is_a($a, "I"));
26var_dump(is_subclass_of($a, "B2"));
27var_dump(is_subclass_of($a, "A"));
28var_dump(is_subclass_of($a, "BASE"));
29var_dump(is_subclass_of($a, "I"));
30
31var_dump(is_subclass_of("X1", "X2"));
32?>
33--EXPECT--
34bool(false)
35bool(true)
36bool(true)
37bool(true)
38bool(false)
39bool(false)
40bool(true)
41bool(true)
42AUTOLOAD 'X1'
43bool(false)
44