1--TEST--
2Test sql_regcase() function : usage variations  - unexpected arg type
3--FILE--
4<?php
5/* Prototype  : proto string sql_regcase(string string)
6 * Description: Make regular expression for case insensitive match
7 * Source code: ext/standard/reg.c
8 * Alias to functions: msql_regcase
9 */
10
11function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
12	echo "Error: $err_no - $err_msg, $filename($linenum)\n";
13}
14set_error_handler('test_error_handler');
15
16echo "*** Testing sql_regcase() : usage variations ***\n";
17
18// Initialise function arguments not being substituted (if any)
19
20//get an unset variable
21$unset_var = 10;
22unset ($unset_var);
23
24//array of values to iterate over
25$values = array(
26
27      // int data
28      0,
29      1,
30      12345,
31      -2345,
32
33      // float data
34      10.5,
35      -10.5,
36      10.1234567e10,
37      10.7654321E-10,
38      .5,
39
40      // array data
41      array(),
42      array(0),
43      array(1),
44      array(1, 2),
45      array('color' => 'red', 'item' => 'pen'),
46
47      // null data
48      NULL,
49      null,
50
51      // boolean data
52      true,
53      false,
54      TRUE,
55      FALSE,
56
57      // empty data
58      "",
59      '',
60
61      // object data
62      new stdclass(),
63
64      // undefined data
65      $undefined_var,
66
67      // unset data
68      $unset_var,
69);
70
71// loop through each element of the array for string
72
73foreach($values as $value) {
74      echo "\nArg value $value \n";
75      var_dump( sql_regcase($value) );
76};
77
78echo "Done";
79?>
80--EXPECTF--
81*** Testing sql_regcase() : usage variations ***
82Error: 8 - Undefined variable: undefined_var, %s(62)
83Error: 8 - Undefined variable: unset_var, %s(65)
84
85Arg value 0
86Error: 8192 - Function sql_regcase() is deprecated, %s(72)
87string(1) "0"
88
89Arg value 1
90Error: 8192 - Function sql_regcase() is deprecated, %s(72)
91string(1) "1"
92
93Arg value 12345
94Error: 8192 - Function sql_regcase() is deprecated, %s(72)
95string(5) "12345"
96
97Arg value -2345
98Error: 8192 - Function sql_regcase() is deprecated, %s(72)
99string(5) "-2345"
100
101Arg value 10.5
102Error: 8192 - Function sql_regcase() is deprecated, %s(72)
103string(4) "10.5"
104
105Arg value -10.5
106Error: 8192 - Function sql_regcase() is deprecated, %s(72)
107string(5) "-10.5"
108
109Arg value 101234567000
110Error: 8192 - Function sql_regcase() is deprecated, %s(72)
111string(12) "101234567000"
112
113Arg value 1.07654321E-9
114Error: 8192 - Function sql_regcase() is deprecated, %s(72)
115string(16) "1.07654321[Ee]-9"
116
117Arg value 0.5
118Error: 8192 - Function sql_regcase() is deprecated, %s(72)
119string(3) "0.5"
120
121Arg value Array
122Error: 8192 - Function sql_regcase() is deprecated, %s(72)
123Error: 2 - sql_regcase() expects parameter 1 to be string, array given, %s(72)
124NULL
125
126Arg value Array
127Error: 8192 - Function sql_regcase() is deprecated, %s(72)
128Error: 2 - sql_regcase() expects parameter 1 to be string, array given, %s(72)
129NULL
130
131Arg value Array
132Error: 8192 - Function sql_regcase() is deprecated, %s(72)
133Error: 2 - sql_regcase() expects parameter 1 to be string, array given, %s(72)
134NULL
135
136Arg value Array
137Error: 8192 - Function sql_regcase() is deprecated, %s(72)
138Error: 2 - sql_regcase() expects parameter 1 to be string, array given, %s(72)
139NULL
140
141Arg value Array
142Error: 8192 - Function sql_regcase() is deprecated, %s(72)
143Error: 2 - sql_regcase() expects parameter 1 to be string, array given, %s(72)
144NULL
145
146Arg value
147Error: 8192 - Function sql_regcase() is deprecated, %s(72)
148string(0) ""
149
150Arg value
151Error: 8192 - Function sql_regcase() is deprecated, %s(72)
152string(0) ""
153
154Arg value 1
155Error: 8192 - Function sql_regcase() is deprecated, %s(72)
156string(1) "1"
157
158Arg value
159Error: 8192 - Function sql_regcase() is deprecated, %s(72)
160string(0) ""
161
162Arg value 1
163Error: 8192 - Function sql_regcase() is deprecated, %s(72)
164string(1) "1"
165
166Arg value
167Error: 8192 - Function sql_regcase() is deprecated, %s(72)
168string(0) ""
169
170Arg value
171Error: 8192 - Function sql_regcase() is deprecated, %s(72)
172string(0) ""
173
174Arg value
175Error: 8192 - Function sql_regcase() is deprecated, %s(72)
176string(0) ""
177Error: 4096 - Object of class stdClass could not be converted to string, %s(71)
178
179Arg value
180Error: 8192 - Function sql_regcase() is deprecated, %s(72)
181Error: 2 - sql_regcase() expects parameter 1 to be string, object given, %s(72)
182NULL
183
184Arg value
185Error: 8192 - Function sql_regcase() is deprecated, %s(72)
186string(0) ""
187
188Arg value
189Error: 8192 - Function sql_regcase() is deprecated, %s(72)
190string(0) ""
191Done
192