1--TEST--
2Test is_subclass_of() function : usage variations  - unexpected type for arg 1
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
11function __autoload($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 = 'string_val';
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)
118
119Arg value Array
120bool(false)
121
122Arg value Array
123bool(false)
124
125Arg value Array
126bool(false)
127
128Arg value Array
129bool(false)
130
131Arg value Array
132bool(false)
133
134Arg value
135bool(false)
136
137Arg value
138bool(false)
139
140Arg value 1
141bool(false)
142
143Arg value
144bool(false)
145
146Arg value 1
147bool(false)
148
149Arg value
150bool(false)
151
152Arg value
153bool(false)
154
155Arg value
156bool(false)
157
158Arg value string
159In __autoload(string)
160bool(false)
161
162Arg value String
163In __autoload(String)
164bool(false)
165
166Arg value
167bool(false)
168
169Arg value
170bool(false)
171Done