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