1--TEST--
2Test get_class() function : usage variations  - passing unexpected types.
3--FILE--
4<?php
5/* Prototype  : proto string get_class([object object])
6 * Description: Retrieves the class name
7 * Source code: Zend/zend_builtin_functions.c
8 * Alias to functions:
9 */
10
11echo "*** Testing get_class() : usage variations ***\n";
12
13//  Note: basic use cases in Zend/tests/009.phpt
14
15//get an unset variable
16$unset_var = 10;
17unset ($unset_var);
18
19//array of values to iterate over
20$values = array(
21
22      // int data
23      0,
24      1,
25      12345,
26      -2345,
27
28      // float data
29      10.5,
30      -10.5,
31      10.1234567e10,
32      10.7654321E-10,
33      .5,
34
35      // array data
36      array(),
37      array(0),
38      array(1),
39      array(1, 2),
40      array('color' => 'red', 'item' => 'pen'),
41
42      // null data
43      NULL,
44      null,
45
46      // boolean data
47      true,
48      false,
49      TRUE,
50      FALSE,
51
52      // empty data
53      "",
54      '',
55
56      // string data
57      "string",
58      'string',
59
60      // undefined data
61      $undefined_var,
62
63      // unset data
64      $unset_var,
65);
66
67// loop through each element of the array for object
68
69foreach($values as $value) {
70      echo @"\nArg value: $value (type: " . gettype($value) . ")\n";
71      var_dump( get_class($value) );
72};
73
74echo "Done";
75?>
76--EXPECTF--
77*** Testing get_class() : usage variations ***
78
79Notice: Undefined variable: undefined_var in %sget_class_variation_001.php on line 58
80
81Notice: Undefined variable: unset_var in %sget_class_variation_001.php on line 61
82
83Arg value: 0 (type: integer)
84
85Warning: get_class() expects parameter 1 to be object, int given in %sget_class_variation_001.php on line %d
86bool(false)
87
88Arg value: 1 (type: integer)
89
90Warning: get_class() expects parameter 1 to be object, int given in %sget_class_variation_001.php on line %d
91bool(false)
92
93Arg value: 12345 (type: integer)
94
95Warning: get_class() expects parameter 1 to be object, int given in %sget_class_variation_001.php on line %d
96bool(false)
97
98Arg value: -2345 (type: integer)
99
100Warning: get_class() expects parameter 1 to be object, int given in %sget_class_variation_001.php on line %d
101bool(false)
102
103Arg value: 10.5 (type: double)
104
105Warning: get_class() expects parameter 1 to be object, float given in %sget_class_variation_001.php on line %d
106bool(false)
107
108Arg value: -10.5 (type: double)
109
110Warning: get_class() expects parameter 1 to be object, float given in %sget_class_variation_001.php on line %d
111bool(false)
112
113Arg value: 101234567000 (type: double)
114
115Warning: get_class() expects parameter 1 to be object, float given in %sget_class_variation_001.php on line %d
116bool(false)
117
118Arg value: 1.07654321E-9 (type: double)
119
120Warning: get_class() expects parameter 1 to be object, float given in %sget_class_variation_001.php on line %d
121bool(false)
122
123Arg value: 0.5 (type: double)
124
125Warning: get_class() expects parameter 1 to be object, float given in %sget_class_variation_001.php on line %d
126bool(false)
127
128Arg value: Array (type: array)
129
130Warning: get_class() expects parameter 1 to be object, array given in %sget_class_variation_001.php on line %d
131bool(false)
132
133Arg value: Array (type: array)
134
135Warning: get_class() expects parameter 1 to be object, array given in %sget_class_variation_001.php on line %d
136bool(false)
137
138Arg value: Array (type: array)
139
140Warning: get_class() expects parameter 1 to be object, array given in %sget_class_variation_001.php on line %d
141bool(false)
142
143Arg value: Array (type: array)
144
145Warning: get_class() expects parameter 1 to be object, array given in %sget_class_variation_001.php on line %d
146bool(false)
147
148Arg value: Array (type: array)
149
150Warning: get_class() expects parameter 1 to be object, array given in %sget_class_variation_001.php on line %d
151bool(false)
152
153Arg value:  (type: NULL)
154
155Warning: get_class() expects parameter 1 to be object, null given in %s on line %d
156bool(false)
157
158Arg value:  (type: NULL)
159
160Warning: get_class() expects parameter 1 to be object, null given in %s on line %d
161bool(false)
162
163Arg value: 1 (type: boolean)
164
165Warning: get_class() expects parameter 1 to be object, bool given in %sget_class_variation_001.php on line %d
166bool(false)
167
168Arg value:  (type: boolean)
169
170Warning: get_class() expects parameter 1 to be object, bool given in %sget_class_variation_001.php on line %d
171bool(false)
172
173Arg value: 1 (type: boolean)
174
175Warning: get_class() expects parameter 1 to be object, bool given in %sget_class_variation_001.php on line %d
176bool(false)
177
178Arg value:  (type: boolean)
179
180Warning: get_class() expects parameter 1 to be object, bool given in %sget_class_variation_001.php on line %d
181bool(false)
182
183Arg value:  (type: string)
184
185Warning: get_class() expects parameter 1 to be object, string given in %sget_class_variation_001.php on line %d
186bool(false)
187
188Arg value:  (type: string)
189
190Warning: get_class() expects parameter 1 to be object, string given in %sget_class_variation_001.php on line %d
191bool(false)
192
193Arg value: string (type: string)
194
195Warning: get_class() expects parameter 1 to be object, string given in %sget_class_variation_001.php on line %d
196bool(false)
197
198Arg value: string (type: string)
199
200Warning: get_class() expects parameter 1 to be object, string given in %sget_class_variation_001.php on line %d
201bool(false)
202
203Arg value:  (type: NULL)
204
205Warning: get_class() expects parameter 1 to be object, null given in %s on line %d
206bool(false)
207
208Arg value:  (type: NULL)
209
210Warning: get_class() expects parameter 1 to be object, null given in %s on line %d
211bool(false)
212Done
213