xref: /PHP-7.3/Zend/tests/bug46304.phpt (revision 3588d8af)
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--
43Deprecated: define(): Declaration of case-insensitive constants is deprecated in %s on line 6
44
45Deprecated: define(): Declaration of case-insensitive constants is deprecated in %s on line 7
46
47Deprecated: define(): Declaration of case-insensitive constants is deprecated in %s on line 8
48value1
49value1
50value1
51value2
52value2
53value2
54value3
55value3
56value3
57value4
58value4
59value4
60
61Deprecated: Case-insensitive constants are deprecated. The correct casing for this constant is "NS1\ns2\const4" in %s on line 25
62value4
63value5
64value5
65value5
66
67Deprecated: Case-insensitive constants are deprecated. The correct casing for this constant is "ns1\ns2\const5" in %s on line 30
68value5
69
70Deprecated: Case-insensitive constants are deprecated. The correct casing for this constant is "ns1\NS2\coNSt6" in %s on line 32
71value6
72
73Deprecated: Case-insensitive constants are deprecated. The correct casing for this constant is "ns1\NS2\coNSt6" in %s on line 33
74value6
75
76Deprecated: Case-insensitive constants are deprecated. The correct casing for this constant is "ns1\NS2\coNSt6" in %s on line 34
77value6
78value6
79
80Fatal error: Uncaught Error: Undefined constant 'NS1\ns2\coNSt1' in %sbug46304.php:%d
81Stack trace:
82#0 {main}
83  thrown in %sbug46304.php on line %d
84