1--TEST-- 2Test get_parent_class() function : usage variations - unexpected argument type. 3--FILE-- 4<?php 5/* Prototype : proto string get_parent_class([mixed object]) 6 * Description: Retrieves the parent class name for object or class or current scope. 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 get_parent_class() : usage variations ***\n"; 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 // string data 64 "string", 65 'String', 66 67 // object data 68 new stdclass(), 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( get_parent_class($value) ); 82}; 83 84echo "Done"; 85?> 86--EXPECTF-- 87*** Testing get_parent_class() : 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) 117 118Arg value Array 119bool(false) 120 121Arg value Array 122bool(false) 123 124Arg value Array 125bool(false) 126 127Arg value Array 128bool(false) 129 130Arg value Array 131bool(false) 132 133Arg value 134bool(false) 135 136Arg value 137bool(false) 138 139Arg value 1 140bool(false) 141 142Arg value 143bool(false) 144 145Arg value 1 146bool(false) 147 148Arg value 149bool(false) 150 151Arg value 152bool(false) 153 154Arg value 155bool(false) 156 157Arg value string 158In __autoload(string) 159bool(false) 160 161Arg value String 162In __autoload(String) 163bool(false) 164Error: 4096 - Object of class stdClass could not be converted to string, %s(77) 165 166Arg value 167bool(false) 168 169Arg value 170bool(false) 171 172Arg value 173bool(false) 174Done