1--TEST--
2Test get_class_methods() function : usage variations  - unexpected types
3--FILE--
4<?php
5/* Prototype  : proto array get_class_methods(mixed class)
6 * Description: Returns an array of method names for class or class instance.
7 * Source code: Zend/zend_builtin_functions.c
8 * Alias to functions:
9 */
10
11
12function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
13	echo "Error: $err_no - $err_msg, $filename($linenum)\n";
14}
15set_error_handler('test_error_handler');
16
17echo "*** Testing get_class_methods() : usage variations ***\n";
18
19// Initialise function arguments not being substituted (if any)
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      // object data
67      new stdclass(),
68
69      // undefined data
70      $undefined_var,
71
72      // unset data
73      $unset_var,
74);
75
76// loop through each element of the array for class
77
78foreach($values as $value) {
79      echo "\nArg value $value \n";
80      var_dump( get_class_methods($value) );
81};
82
83echo "Done";
84?>
85--EXPECTF--
86*** Testing get_class_methods() : usage variations ***
87Error: 8 - Undefined variable: undefined_var, %s(67)
88Error: 8 - Undefined variable: unset_var, %s(70)
89
90Arg value 0
91NULL
92
93Arg value 1
94NULL
95
96Arg value 12345
97NULL
98
99Arg value -2345
100NULL
101
102Arg value 10.5
103NULL
104
105Arg value -10.5
106NULL
107
108Arg value 101234567000
109NULL
110
111Arg value 1.07654321E-9
112NULL
113
114Arg value 0.5
115NULL
116Error: 8 - Array to string conversion, %sget_class_methods_variation_001.php(%d)
117
118Arg value Array
119NULL
120Error: 8 - Array to string conversion, %sget_class_methods_variation_001.php(%d)
121
122Arg value Array
123NULL
124Error: 8 - Array to string conversion, %sget_class_methods_variation_001.php(%d)
125
126Arg value Array
127NULL
128Error: 8 - Array to string conversion, %sget_class_methods_variation_001.php(%d)
129
130Arg value Array
131NULL
132Error: 8 - Array to string conversion, %sget_class_methods_variation_001.php(%d)
133
134Arg value Array
135NULL
136
137Arg value
138NULL
139
140Arg value
141NULL
142
143Arg value 1
144NULL
145
146Arg value
147NULL
148
149Arg value 1
150NULL
151
152Arg value
153NULL
154
155Arg value
156NULL
157
158Arg value
159NULL
160
161Arg value string
162NULL
163
164Arg value string
165NULL
166Error: 4096 - Object of class stdClass could not be converted to string, %s(76)
167
168Arg value
169array(0) {
170}
171
172Arg value
173NULL
174
175Arg value
176NULL
177Done
178