xref: /PHP-8.2/Zend/tests/bug42820.phpt (revision 7aacc705)
1--TEST--
2Bug #42820 (defined() on constant with namespace prefixes tries to load class)
3--FILE--
4<?php
5namespace ns;
6const ok = 0;
7class foo {
8    const ok = 0;
9}
10var_dump(defined('ns\\ok'));
11var_dump(defined('ns\\bug'));
12var_dump(defined('\\ns\\ok'));
13var_dump(defined('\\ns\\bug'));
14var_dump(defined('ns\\foo::ok'));
15var_dump(defined('ns\\foo::bug'));
16var_dump(defined('\\ns\\foo::ok'));
17var_dump(defined('\\ns\\foo::bug'));
18var_dump(defined('ns\\bar::bug'));
19var_dump(defined('\\ns\\bar::bug'));
20?>
21--EXPECT--
22bool(true)
23bool(false)
24bool(true)
25bool(false)
26bool(true)
27bool(false)
28bool(true)
29bool(false)
30bool(false)
31bool(false)
32