1--TEST--
2Test is_subclass_of() function : usage variations  - unexpected type for arg 1
3--FILE--
4<?php
5// Note: basic use cases in Zend/tests/is_a.phpt
6spl_autoload_register(function ($className) {
7    echo "In autoload($className)\n";
8});
9
10function test_error_handler($err_no, $err_msg, $filename, $linenum) {
11    echo "Error: $err_no - $err_msg\n";
12}
13set_error_handler('test_error_handler');
14
15
16echo "*** Testing is_subclass_of() : usage variations ***\n";
17
18// Initialise function arguments not being substituted (if any)
19$class_name = 'string_val';
20
21//get an unset variable
22$unset_var = 10;
23unset ($unset_var);
24
25//array of values to iterate over
26$values = array(
27
28      // int data
29      0,
30      1,
31      12345,
32      -2345,
33
34      // float data
35      10.5,
36      -10.5,
37      10.1234567e10,
38      10.7654321E-10,
39      .5,
40
41      // array data
42      array(),
43      array(0),
44      array(1),
45      array(1, 2),
46      array('color' => 'red', 'item' => 'pen'),
47
48      // null data
49      NULL,
50      null,
51
52      // boolean data
53      true,
54      false,
55      TRUE,
56      FALSE,
57
58      // empty data
59      "",
60      '',
61
62      // string data
63      "string",
64      'String',
65
66      // undefined data
67      $undefined_var,
68
69      // unset data
70      $unset_var,
71);
72
73// loop through each element of the array for object
74
75foreach($values as $value) {
76      echo "\nArg value $value \n";
77      var_dump( is_subclass_of($value, $class_name) );
78};
79
80echo "Done";
81?>
82--EXPECT--
83*** Testing is_subclass_of() : usage variations ***
84Error: 2 - Undefined variable $undefined_var
85Error: 2 - Undefined variable $unset_var
86
87Arg value 0
88bool(false)
89
90Arg value 1
91bool(false)
92
93Arg value 12345
94bool(false)
95
96Arg value -2345
97bool(false)
98
99Arg value 10.5
100bool(false)
101
102Arg value -10.5
103bool(false)
104
105Arg value 101234567000
106bool(false)
107
108Arg value 1.07654321E-9
109bool(false)
110
111Arg value 0.5
112bool(false)
113Error: 2 - Array to string conversion
114
115Arg value Array
116bool(false)
117Error: 2 - Array to string conversion
118
119Arg value Array
120bool(false)
121Error: 2 - Array to string conversion
122
123Arg value Array
124bool(false)
125Error: 2 - Array to string conversion
126
127Arg value Array
128bool(false)
129Error: 2 - Array to string conversion
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
172