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