1--TEST--
2Case-insensitive constants are deprecated
3--FILE--
4<?php
5
6namespace {
7    define('FOO', 42, true); // Deprecated
8    define('NS\FOO', 24, true); // Deprecated
9
10    var_dump(FOO); // Ok
11    var_dump(foo); // Deprecated
12    var_dump(\foo); // Deprecated
13
14    var_dump(NS\FOO); // Ok
15    var_dump(ns\FOO); // Ok
16    var_dump(ns\foo); // Deprecated
17
18    var_dump(defined('FOO')); // Ok
19    var_dump(defined('foo')); // Ok
20    var_dump(defined('NS\FOO')); // Ok
21    var_dump(defined('ns\FOO')); // Ok
22    var_dump(defined('ns\foo')); // Ok
23
24    var_dump(constant('FOO')); // Ok
25    var_dump(constant('foo')); // Deprecated
26    var_dump(constant('NS\FOO')); // Ok
27    var_dump(constant('ns\FOO')); // Ok
28    var_dump(constant('ns\foo')); // Deprecated
29}
30
31namespace NS {
32    var_dump(FOO); // Ok
33    var_dump(foo); // Deprecated
34}
35
36namespace ns {
37    var_dump(FOO); // Ok
38    var_dump(foo); // Deprecated
39}
40
41namespace Other {
42    var_dump(FOO); // Ok
43    var_dump(foo); // Deprecated
44
45    var_dump(defined('FOO')); // Ok
46    var_dump(defined('foo')); // Ok
47    var_dump(defined('NS\FOO')); // Ok
48    var_dump(defined('ns\FOO')); // Ok
49    var_dump(defined('ns\foo')); // Ok
50
51    var_dump(constant('FOO')); // Ok
52    var_dump(constant('foo')); // Deprecated
53    var_dump(constant('NS\FOO')); // Ok
54    var_dump(constant('ns\FOO')); // Ok
55    var_dump(constant('ns\foo')); // Deprecated
56
57    const C1 = FOO; // Ok
58    var_dump(C1);
59    const C2 = foo; // Deprecated
60    var_dump(C2);
61    const C3 = 1 + FOO; // Ok
62    var_dump(C3);
63    const C4 = 1 + foo; // Deprecated
64    var_dump(C4);
65}
66
67?>
68--EXPECTF--
69Deprecated: define(): Declaration of case-insensitive constants is deprecated in %s on line 4
70
71Deprecated: define(): Declaration of case-insensitive constants is deprecated in %s on line 5
72int(42)
73
74Deprecated: Case-insensitive constants are deprecated. The correct casing for this constant is "FOO" in %s on line 8
75int(42)
76
77Deprecated: Case-insensitive constants are deprecated. The correct casing for this constant is "FOO" in %s on line 9
78int(42)
79int(24)
80int(24)
81
82Deprecated: Case-insensitive constants are deprecated. The correct casing for this constant is "NS\FOO" in %s on line 13
83int(24)
84bool(true)
85bool(true)
86bool(true)
87bool(true)
88bool(true)
89int(42)
90
91Deprecated: Case-insensitive constants are deprecated. The correct casing for this constant is "FOO" in %s on line 22
92int(42)
93int(24)
94int(24)
95
96Deprecated: Case-insensitive constants are deprecated. The correct casing for this constant is "NS\FOO" in %s on line 25
97int(24)
98int(24)
99
100Deprecated: Case-insensitive constants are deprecated. The correct casing for this constant is "NS\FOO" in %s on line 30
101int(24)
102int(24)
103
104Deprecated: Case-insensitive constants are deprecated. The correct casing for this constant is "NS\FOO" in %s on line 35
105int(24)
106int(42)
107
108Deprecated: Case-insensitive constants are deprecated. The correct casing for this constant is "FOO" in %s on line 40
109int(42)
110bool(true)
111bool(true)
112bool(true)
113bool(true)
114bool(true)
115int(42)
116
117Deprecated: Case-insensitive constants are deprecated. The correct casing for this constant is "FOO" in %s on line 49
118int(42)
119int(24)
120int(24)
121
122Deprecated: Case-insensitive constants are deprecated. The correct casing for this constant is "NS\FOO" in %s on line 52
123int(24)
124int(42)
125
126Deprecated: Case-insensitive constants are deprecated. The correct casing for this constant is "FOO" in %s on line 56
127int(42)
128int(43)
129
130Deprecated: Case-insensitive constants are deprecated. The correct casing for this constant is "FOO" in %s on line 60
131int(43)
132