xref: /PHP-7.2/Zend/tests/bug46304.phpt (revision e97d5fab)
1--TEST--
2Bug #46304 (defining namespaced constant using define())
3--FILE--
4<?php
5
6define('NS1\ns2\const1','value1');
7define('ns1\ns2\const2','value2');
8define('ns1\NS2\coNSt3','value3');
9define('NS1\ns2\const4','value4', true);
10define('ns1\ns2\const5','value5', true);
11define('ns1\NS2\coNSt6','value6', true);
12
13print NS1\ns2\const1 . "\n";
14print ns1\ns2\const1 . "\n";
15print ns1\NS2\const1 . "\n";
16
17print NS1\ns2\const2 . "\n";
18print ns1\ns2\const2 . "\n";
19print ns1\NS2\const2 . "\n";
20
21print NS1\ns2\coNSt3 . "\n";
22print ns1\ns2\coNSt3 . "\n";
23print ns1\ns2\coNSt3 . "\n";
24
25print NS1\ns2\const4 . "\n";
26print ns1\ns2\const4 . "\n";
27print ns1\NS2\const4 . "\n";
28print ns1\ns2\coNSt4 . "\n";
29
30print NS1\ns2\const5 . "\n";
31print ns1\ns2\const5 . "\n";
32print ns1\NS2\const5 . "\n";
33print ns1\ns2\coNSt5 . "\n";
34
35print NS1\ns2\const6 . "\n";
36print ns1\ns2\const6 . "\n";
37print ns1\NS2\const6 . "\n";
38print ns1\ns2\coNSt6 . "\n";
39
40print NS1\ns2\coNSt1 . "\n";
41?>
42--EXPECTF--
43value1
44value1
45value1
46value2
47value2
48value2
49value3
50value3
51value3
52value4
53value4
54value4
55value4
56value5
57value5
58value5
59value5
60value6
61value6
62value6
63value6
64
65Fatal error: Uncaught Error: Undefined constant 'NS1\ns2\coNSt1' in %sbug46304.php:%d
66Stack trace:
67#0 {main}
68  thrown in %sbug46304.php on line %d
69