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 116 117Arg value Array 118NULL 119 120Arg value Array 121NULL 122 123Arg value Array 124NULL 125 126Arg value Array 127NULL 128 129Arg value Array 130NULL 131 132Arg value 133NULL 134 135Arg value 136NULL 137 138Arg value 1 139NULL 140 141Arg value 142NULL 143 144Arg value 1 145NULL 146 147Arg value 148NULL 149 150Arg value 151NULL 152 153Arg value 154NULL 155 156Arg value string 157NULL 158 159Arg value string 160NULL 161Error: 4096 - Object of class stdClass could not be converted to string, %s(76) 162 163Arg value 164array(0) { 165} 166 167Arg value 168NULL 169 170Arg value 171NULL 172Done