1--TEST--
2Test method_exists() function : usage variations  - unexpected type for arg 1
3--FILE--
4<?php
5/* Prototype  : proto bool method_exists(object object, string method)
6 * Description: Checks if the class method exists
7 * Source code: Zend/zend_builtin_functions.c
8 * Alias to functions:
9 */
10
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
20echo "*** Testing method_exists() : usage variations ***\n";
21
22// Initialise function arguments not being substituted (if any)
23$method = 'string_val';
24
25//get an unset variable
26$unset_var = 10;
27unset ($unset_var);
28
29//array of values to iterate over
30$values = array(
31
32      // int data
33      0,
34      1,
35      12345,
36      -2345,
37
38      // float data
39      10.5,
40      -10.5,
41      10.1234567e10,
42      10.7654321E-10,
43      .5,
44
45      // array data
46      array(),
47      array(0),
48      array(1),
49      array(1, 2),
50      array('color' => 'red', 'item' => 'pen'),
51
52      // null data
53      NULL,
54      null,
55
56      // boolean data
57      true,
58      false,
59      TRUE,
60      FALSE,
61
62      // empty data
63      "",
64      '',
65
66      // string data
67      "string",
68      'String',
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 $value \n";
81      var_dump( method_exists($value, $method) );
82};
83
84echo "Done";
85?>
86--EXPECTF--
87*** Testing method_exists() : 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, %smethod_exists_variation_001.php(%d)
118
119Arg value Array
120bool(false)
121Error: 8 - Array to string conversion, %smethod_exists_variation_001.php(%d)
122
123Arg value Array
124bool(false)
125Error: 8 - Array to string conversion, %smethod_exists_variation_001.php(%d)
126
127Arg value Array
128bool(false)
129Error: 8 - Array to string conversion, %smethod_exists_variation_001.php(%d)
130
131Arg value Array
132bool(false)
133Error: 8 - Array to string conversion, %smethod_exists_variation_001.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
171bool(false)
172
173Arg value
174bool(false)
175Done