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