1--TEST-- 2Test spliti() function : usage variations - unexpected type for arg 3 3--FILE-- 4<?php 5/* Prototype : proto array spliti(string pattern, string string [, int limit]) 6 * Description: spliti string into array by regular expression 7 * Source code: ext/standard/reg.c 8 * Alias to functions: 9 */ 10 11function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) { 12 if (error_reporting() != 0) { 13 // report non-silenced errors 14 echo "Error: $err_no - $err_msg, $filename($linenum)\n"; 15 } 16} 17set_error_handler('test_error_handler'); 18echo "*** Testing spliti() : usage variations ***\n"; 19 20// Initialise function arguments not being substituted (if any) 21$pattern = b'[[:space:]]'; 22$string = '1 2 3 4 5'; 23 24//get an unset variable 25$unset_var = 10; 26unset ($unset_var); 27 28//array of values to iterate over 29$values = array( 30 31 // float data 32 10.5, 33 -10.5, 34 10.7654321E-10, 35 .5, 36 37 // array data 38 array(), 39 array(0), 40 array(1), 41 array(1, 2), 42 array('color' => 'red', 'item' => 'pen'), 43 44 // null data 45 NULL, 46 null, 47 48 // boolean data 49 true, 50 false, 51 TRUE, 52 FALSE, 53 54 // empty data 55 "", 56 '', 57 58 // string data 59 "string", 60 'string', 61 62 // object data 63 new stdclass(), 64 65 // undefined data 66 @$undefined_var, 67 68 // unset data 69 @$unset_var, 70); 71 72// loop through each element of the array for limit 73 74foreach($values as $value) { 75 echo "\nArg value $value \n"; 76 var_dump( spliti($pattern, $string, $value) ); 77}; 78 79echo "Done"; 80?> 81--EXPECTF-- 82*** Testing spliti() : usage variations *** 83 84Arg value 10.5 85Error: 8192 - Function spliti() is deprecated, %s(73) 86array(5) { 87 [0]=> 88 string(1) "1" 89 [1]=> 90 string(1) "2" 91 [2]=> 92 string(1) "3" 93 [3]=> 94 string(1) "4" 95 [4]=> 96 string(1) "5" 97} 98 99Arg value -10.5 100Error: 8192 - Function spliti() is deprecated, %s(73) 101array(1) { 102 [0]=> 103 string(9) "1 2 3 4 5" 104} 105 106Arg value 1.07654321E-9 107Error: 8192 - Function spliti() is deprecated, %s(73) 108array(1) { 109 [0]=> 110 string(9) "1 2 3 4 5" 111} 112 113Arg value 0.5 114Error: 8192 - Function spliti() is deprecated, %s(73) 115array(1) { 116 [0]=> 117 string(9) "1 2 3 4 5" 118} 119Error: 8 - Array to string conversion, %sspliti_variation_003.php(%d) 120 121Arg value Array 122Error: 8192 - Function spliti() is deprecated, %s(73) 123Error: 2 - spliti() expects parameter 3 to be long, array given, %s(73) 124NULL 125Error: 8 - Array to string conversion, %sspliti_variation_003.php(%d) 126 127Arg value Array 128Error: 8192 - Function spliti() is deprecated, %s(73) 129Error: 2 - spliti() expects parameter 3 to be long, array given, %s(73) 130NULL 131Error: 8 - Array to string conversion, %sspliti_variation_003.php(%d) 132 133Arg value Array 134Error: 8192 - Function spliti() is deprecated, %s(73) 135Error: 2 - spliti() expects parameter 3 to be long, array given, %s(73) 136NULL 137Error: 8 - Array to string conversion, %sspliti_variation_003.php(%d) 138 139Arg value Array 140Error: 8192 - Function spliti() is deprecated, %s(73) 141Error: 2 - spliti() expects parameter 3 to be long, array given, %s(73) 142NULL 143Error: 8 - Array to string conversion, %sspliti_variation_003.php(%d) 144 145Arg value Array 146Error: 8192 - Function spliti() is deprecated, %s(73) 147Error: 2 - spliti() expects parameter 3 to be long, array given, %s(73) 148NULL 149 150Arg value 151Error: 8192 - Function spliti() is deprecated, %s(73) 152array(1) { 153 [0]=> 154 string(9) "1 2 3 4 5" 155} 156 157Arg value 158Error: 8192 - Function spliti() is deprecated, %s(73) 159array(1) { 160 [0]=> 161 string(9) "1 2 3 4 5" 162} 163 164Arg value 1 165Error: 8192 - Function spliti() is deprecated, %s(73) 166array(1) { 167 [0]=> 168 string(9) "1 2 3 4 5" 169} 170 171Arg value 172Error: 8192 - Function spliti() is deprecated, %s(73) 173array(1) { 174 [0]=> 175 string(9) "1 2 3 4 5" 176} 177 178Arg value 1 179Error: 8192 - Function spliti() is deprecated, %s(73) 180array(1) { 181 [0]=> 182 string(9) "1 2 3 4 5" 183} 184 185Arg value 186Error: 8192 - Function spliti() is deprecated, %s(73) 187array(1) { 188 [0]=> 189 string(9) "1 2 3 4 5" 190} 191 192Arg value 193Error: 8192 - Function spliti() is deprecated, %s(73) 194Error: 2 - spliti() expects parameter 3 to be long, string given, %s(73) 195NULL 196 197Arg value 198Error: 8192 - Function spliti() is deprecated, %s(73) 199Error: 2 - spliti() expects parameter 3 to be long, string given, %s(73) 200NULL 201 202Arg value string 203Error: 8192 - Function spliti() is deprecated, %s(73) 204Error: 2 - spliti() expects parameter 3 to be long, string given, %s(73) 205NULL 206 207Arg value string 208Error: 8192 - Function spliti() is deprecated, %s(73) 209Error: 2 - spliti() expects parameter 3 to be long, string given, %s(73) 210NULL 211Error: 4096 - Object of class stdClass could not be converted to string, %s(72) 212 213Arg value 214Error: 8192 - Function spliti() is deprecated, %s(73) 215Error: 2 - spliti() expects parameter 3 to be long, object given, %s(73) 216NULL 217 218Arg value 219Error: 8192 - Function spliti() is deprecated, %s(73) 220array(1) { 221 [0]=> 222 string(9) "1 2 3 4 5" 223} 224 225Arg value 226Error: 8192 - Function spliti() is deprecated, %s(73) 227array(1) { 228 [0]=> 229 string(9) "1 2 3 4 5" 230} 231Done