1--TEST--
2Test is_a() function : usage variations  - wrong type for arg 2
3--FILE--
4<?php
5/* Prototype  : proto bool is_a(object object, string class_name)
6 * Description: Returns true if the object is of this class or has this class as one of its parents
7 * Source code: Zend/zend_builtin_functions.c
8 * Alias to functions:
9 */
10
11class C {
12	function __toString() {
13		return "C Instance";
14	}
15}
16
17echo "*** Testing is_a() : usage variations ***\n";
18
19// Initialise function arguments not being substituted (if any)
20$object = new stdclass();
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      // object data
64      new C,
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 class_name
74
75foreach($values as $value) {
76      echo @"\nArg value $value \n";
77      var_dump( is_a($object, $value) );
78};
79
80echo "Done";
81?>
82--EXPECTF--
83*** Testing is_a() : usage variations ***
84
85Notice: Undefined variable: undefined_var in %s on line 64
86
87Notice: Undefined variable: unset_var in %s on line 67
88
89Arg value 0
90bool(false)
91
92Arg value 1
93bool(false)
94
95Arg value 12345
96bool(false)
97
98Arg value -2345
99bool(false)
100
101Arg value 10.5
102bool(false)
103
104Arg value -10.5
105bool(false)
106
107Arg value 101234567000
108bool(false)
109
110Arg value 1.07654321E-9
111bool(false)
112
113Arg value 0.5
114bool(false)
115
116Arg value Array
117
118Warning: is_a() expects parameter 2 to be string, array given in %s on line %d
119NULL
120
121Arg value Array
122
123Warning: is_a() expects parameter 2 to be string, array given in %s on line %d
124NULL
125
126Arg value Array
127
128Warning: is_a() expects parameter 2 to be string, array given in %s on line %d
129NULL
130
131Arg value Array
132
133Warning: is_a() expects parameter 2 to be string, array given in %s on line %d
134NULL
135
136Arg value Array
137
138Warning: is_a() expects parameter 2 to be string, array given in %s on line %d
139NULL
140
141Arg value
142bool(false)
143
144Arg value
145bool(false)
146
147Arg value 1
148bool(false)
149
150Arg value
151bool(false)
152
153Arg value 1
154bool(false)
155
156Arg value
157bool(false)
158
159Arg value
160bool(false)
161
162Arg value
163bool(false)
164
165Arg value C Instance
166bool(false)
167
168Arg value
169bool(false)
170
171Arg value
172bool(false)
173Done
174