xref: /PHP-7.2/Zend/tests/bug42820.phpt (revision f1d7e3ca)
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--EXPECT--
21bool(true)
22bool(false)
23bool(true)
24bool(false)
25bool(true)
26bool(false)
27bool(true)
28bool(false)
29bool(false)
30bool(false)
31