1--TEST--
2Test ctype_lower() function : usage variations - different data types as $c arg
3--EXTENSIONS--
4ctype
5--FILE--
6<?php
7/*
8 * Pass different data types as $c argument to ctype_lower() to test behaviour
9 */
10
11echo "*** Testing ctype_lower() : usage variations ***\n";
12
13$orig = setlocale(LC_CTYPE, "C");
14
15//get an unset variable
16$unset_var = 10;
17unset ($unset_var);
18
19// get a class
20class classA
21{
22    public function __toString() {
23        return "class";
24    }
25}
26
27// heredoc string
28$heredoc = <<<EOT
29heredoc
30EOT;
31
32// get a resource variable
33$fp = fopen(__FILE__, "r");
34
35// unexpected values to be passed to $c argument
36$inputs = array(
37
38       // int data
39/*1*/  0,
40       1,
41       12345,
42       -2345,
43
44       // float data
45/*5*/  10.5,
46       -10.5,
47       12.3456789000e10,
48       12.3456789000E-10,
49       .5,
50
51       // null data
52/*10*/ NULL,
53       null,
54
55       // boolean data
56/*12*/ true,
57       false,
58       TRUE,
59       FALSE,
60
61       // empty data
62/*16*/ "",
63       '',
64       array(),
65
66       // string data
67/*19*/ "string",
68       'string',
69       $heredoc,
70
71       // object data
72/*22*/ new classA(),
73
74       // undefined data
75/*23*/ @$undefined_var,
76
77       // unset data
78/*24*/ @$unset_var,
79
80       // resource variable
81/*25*/ $fp
82);
83
84// loop through each element of $inputs to check the behavior of ctype_lower()
85$iterator = 1;
86foreach($inputs as $input) {
87    echo "\n-- Iteration $iterator --\n";
88    var_dump( ctype_lower($input) );
89    $iterator++;
90};
91
92fclose($fp);
93
94setlocale(LC_CTYPE, $orig);
95?>
96--EXPECTF--
97*** Testing ctype_lower() : usage variations ***
98
99-- Iteration 1 --
100
101Deprecated: ctype_lower(): Argument of type int will be interpreted as string in the future in %s on line %d
102bool(false)
103
104-- Iteration 2 --
105
106Deprecated: ctype_lower(): Argument of type int will be interpreted as string in the future in %s on line %d
107bool(false)
108
109-- Iteration 3 --
110
111Deprecated: ctype_lower(): Argument of type int will be interpreted as string in the future in %s on line %d
112bool(false)
113
114-- Iteration 4 --
115
116Deprecated: ctype_lower(): Argument of type int will be interpreted as string in the future in %s on line %d
117bool(false)
118
119-- Iteration 5 --
120
121Deprecated: ctype_lower(): Argument of type float will be interpreted as string in the future in %s on line %d
122bool(false)
123
124-- Iteration 6 --
125
126Deprecated: ctype_lower(): Argument of type float will be interpreted as string in the future in %s on line %d
127bool(false)
128
129-- Iteration 7 --
130
131Deprecated: ctype_lower(): Argument of type float will be interpreted as string in the future in %s on line %d
132bool(false)
133
134-- Iteration 8 --
135
136Deprecated: ctype_lower(): Argument of type float will be interpreted as string in the future in %s on line %d
137bool(false)
138
139-- Iteration 9 --
140
141Deprecated: ctype_lower(): Argument of type float will be interpreted as string in the future in %s on line %d
142bool(false)
143
144-- Iteration 10 --
145
146Deprecated: ctype_lower(): Argument of type null will be interpreted as string in the future in %s on line %d
147bool(false)
148
149-- Iteration 11 --
150
151Deprecated: ctype_lower(): Argument of type null will be interpreted as string in the future in %s on line %d
152bool(false)
153
154-- Iteration 12 --
155
156Deprecated: ctype_lower(): Argument of type bool will be interpreted as string in the future in %s on line %d
157bool(false)
158
159-- Iteration 13 --
160
161Deprecated: ctype_lower(): Argument of type bool will be interpreted as string in the future in %s on line %d
162bool(false)
163
164-- Iteration 14 --
165
166Deprecated: ctype_lower(): Argument of type bool will be interpreted as string in the future in %s on line %d
167bool(false)
168
169-- Iteration 15 --
170
171Deprecated: ctype_lower(): Argument of type bool will be interpreted as string in the future in %s on line %d
172bool(false)
173
174-- Iteration 16 --
175bool(false)
176
177-- Iteration 17 --
178bool(false)
179
180-- Iteration 18 --
181
182Deprecated: ctype_lower(): Argument of type array will be interpreted as string in the future in %s on line %d
183bool(false)
184
185-- Iteration 19 --
186bool(true)
187
188-- Iteration 20 --
189bool(true)
190
191-- Iteration 21 --
192bool(true)
193
194-- Iteration 22 --
195
196Deprecated: ctype_lower(): Argument of type classA will be interpreted as string in the future in %s on line %d
197bool(false)
198
199-- Iteration 23 --
200
201Deprecated: ctype_lower(): Argument of type null will be interpreted as string in the future in %s on line %d
202bool(false)
203
204-- Iteration 24 --
205
206Deprecated: ctype_lower(): Argument of type null will be interpreted as string in the future in %s on line %d
207bool(false)
208
209-- Iteration 25 --
210
211Deprecated: ctype_lower(): Argument of type resource will be interpreted as string in the future in %s on line %d
212bool(false)
213