1--TEST-- 2Test array_intersect_uassoc() function : usage variation - Passing unexpected values to mandatory third argument 3--FILE-- 4<?php 5/* Prototype : array array_intersect_uassoc(array arr1, array arr2 [, array ...], callback key_compare_func) 6 * Description: Computes the intersection of arrays with additional index check, compares indexes by a callback function 7 * Source code: ext/standard/array.c 8 */ 9 10echo "*** Testing array_intersect_uassoc() : usage variation ***\n"; 11 12// Initialise function arguments 13$array1 = array("a" => "green", "b" => "brown", "c" => "blue", "red"); 14$array2 = array("a" => "green", "yellow", "red"); 15$array3 = array("a"=>"green", "brown"); 16 17//get an unset variable 18$unset_var = 10; 19unset ($unset_var); 20 21//resource variable 22$fp = fopen(__FILE__, "r"); 23 24// define some classes 25class classWithToString 26{ 27 public function __toString() { 28 return "Class A object"; 29 } 30} 31 32class classWithoutToString 33{ 34} 35 36// heredoc string 37$heredoc = <<<EOT 38hello world 39EOT; 40 41// add arrays 42$index_array = array (1, 2, 3); 43$assoc_array = array ('one' => 1, 'two' => 2); 44 45//array of values to iterate over 46$inputs = array( 47 48 // int data 49 'int 0' => 0, 50 'int 1' => 1, 51 'int 12345' => 12345, 52 'int -12345' => -12345, 53 54 // float data 55 'float 10.5' => 10.5, 56 'float -10.5' => -10.5, 57 'float 12.3456789000e10' => 12.3456789000e10, 58 'float -12.3456789000e10' => -12.3456789000e10, 59 'float .5' => .5, 60 61 // null data 62 'uppercase NULL' => NULL, 63 'lowercase null' => null, 64 65 // boolean data 66 'lowercase true' => true, 67 'lowercase false' =>false, 68 'uppercase TRUE' =>TRUE, 69 'uppercase FALSE' =>FALSE, 70 71 // object data 72 'instance of classWithToString' => new classWithToString(), 73 'instance of classWithoutToString' => new classWithoutToString(), 74 75 // undefined data 76 'undefined var' => @$undefined_var, 77 78 // unset data 79 'unset var' => @$unset_var, 80 81 // resource data 82 'resource' => $fp, 83); 84 85// loop through each element of the array for arr1 86foreach($inputs as $key =>$value) { 87 echo "\n--$key--\n"; 88 var_dump( array_intersect_uassoc($array1, $array2, $value) ); 89 var_dump( array_intersect_uassoc($array1, $array2, $array3, $value) ); 90}; 91 92fclose($fp); 93?> 94===DONE=== 95--EXPECTF-- 96*** Testing array_intersect_uassoc() : usage variation *** 97 98--int 0-- 99 100Warning: array_intersect_uassoc() expects parameter 3 to be a valid callback, no array or string given in %s on line %d 101NULL 102 103Warning: array_intersect_uassoc() expects parameter 4 to be a valid callback, no array or string given in %s on line %d 104NULL 105 106--int 1-- 107 108Warning: array_intersect_uassoc() expects parameter 3 to be a valid callback, no array or string given in %s on line %d 109NULL 110 111Warning: array_intersect_uassoc() expects parameter 4 to be a valid callback, no array or string given in %s on line %d 112NULL 113 114--int 12345-- 115 116Warning: array_intersect_uassoc() expects parameter 3 to be a valid callback, no array or string given in %s on line %d 117NULL 118 119Warning: array_intersect_uassoc() expects parameter 4 to be a valid callback, no array or string given in %s on line %d 120NULL 121 122--int -12345-- 123 124Warning: array_intersect_uassoc() expects parameter 3 to be a valid callback, no array or string given in %s on line %d 125NULL 126 127Warning: array_intersect_uassoc() expects parameter 4 to be a valid callback, no array or string given in %s on line %d 128NULL 129 130--float 10.5-- 131 132Warning: array_intersect_uassoc() expects parameter 3 to be a valid callback, no array or string given in %s on line %d 133NULL 134 135Warning: array_intersect_uassoc() expects parameter 4 to be a valid callback, no array or string given in %s on line %d 136NULL 137 138--float -10.5-- 139 140Warning: array_intersect_uassoc() expects parameter 3 to be a valid callback, no array or string given in %s on line %d 141NULL 142 143Warning: array_intersect_uassoc() expects parameter 4 to be a valid callback, no array or string given in %s on line %d 144NULL 145 146--float 12.3456789000e10-- 147 148Warning: array_intersect_uassoc() expects parameter 3 to be a valid callback, no array or string given in %s on line %d 149NULL 150 151Warning: array_intersect_uassoc() expects parameter 4 to be a valid callback, no array or string given in %s on line %d 152NULL 153 154--float -12.3456789000e10-- 155 156Warning: array_intersect_uassoc() expects parameter 3 to be a valid callback, no array or string given in %s on line %d 157NULL 158 159Warning: array_intersect_uassoc() expects parameter 4 to be a valid callback, no array or string given in %s on line %d 160NULL 161 162--float .5-- 163 164Warning: array_intersect_uassoc() expects parameter 3 to be a valid callback, no array or string given in %s on line %d 165NULL 166 167Warning: array_intersect_uassoc() expects parameter 4 to be a valid callback, no array or string given in %s on line %d 168NULL 169 170--uppercase NULL-- 171 172Warning: array_intersect_uassoc() expects parameter 3 to be a valid callback, no array or string given in %s on line %d 173NULL 174 175Warning: array_intersect_uassoc() expects parameter 4 to be a valid callback, no array or string given in %s on line %d 176NULL 177 178--lowercase null-- 179 180Warning: array_intersect_uassoc() expects parameter 3 to be a valid callback, no array or string given in %s on line %d 181NULL 182 183Warning: array_intersect_uassoc() expects parameter 4 to be a valid callback, no array or string given in %s on line %d 184NULL 185 186--lowercase true-- 187 188Warning: array_intersect_uassoc() expects parameter 3 to be a valid callback, no array or string given in %s on line %d 189NULL 190 191Warning: array_intersect_uassoc() expects parameter 4 to be a valid callback, no array or string given in %s on line %d 192NULL 193 194--lowercase false-- 195 196Warning: array_intersect_uassoc() expects parameter 3 to be a valid callback, no array or string given in %s on line %d 197NULL 198 199Warning: array_intersect_uassoc() expects parameter 4 to be a valid callback, no array or string given in %s on line %d 200NULL 201 202--uppercase TRUE-- 203 204Warning: array_intersect_uassoc() expects parameter 3 to be a valid callback, no array or string given in %s on line %d 205NULL 206 207Warning: array_intersect_uassoc() expects parameter 4 to be a valid callback, no array or string given in %s on line %d 208NULL 209 210--uppercase FALSE-- 211 212Warning: array_intersect_uassoc() expects parameter 3 to be a valid callback, no array or string given in %s on line %d 213NULL 214 215Warning: array_intersect_uassoc() expects parameter 4 to be a valid callback, no array or string given in %s on line %d 216NULL 217 218--instance of classWithToString-- 219 220Warning: array_intersect_uassoc() expects parameter 3 to be a valid callback, no array or string given in %s on line %d 221NULL 222 223Warning: array_intersect_uassoc() expects parameter 4 to be a valid callback, no array or string given in %s on line %d 224NULL 225 226--instance of classWithoutToString-- 227 228Warning: array_intersect_uassoc() expects parameter 3 to be a valid callback, no array or string given in %s on line %d 229NULL 230 231Warning: array_intersect_uassoc() expects parameter 4 to be a valid callback, no array or string given in %s on line %d 232NULL 233 234--undefined var-- 235 236Warning: array_intersect_uassoc() expects parameter 3 to be a valid callback, no array or string given in %s on line %d 237NULL 238 239Warning: array_intersect_uassoc() expects parameter 4 to be a valid callback, no array or string given in %s on line %d 240NULL 241 242--unset var-- 243 244Warning: array_intersect_uassoc() expects parameter 3 to be a valid callback, no array or string given in %s on line %d 245NULL 246 247Warning: array_intersect_uassoc() expects parameter 4 to be a valid callback, no array or string given in %s on line %d 248NULL 249 250--resource-- 251 252Warning: array_intersect_uassoc() expects parameter 3 to be a valid callback, no array or string given in %s on line %d 253NULL 254 255Warning: array_intersect_uassoc() expects parameter 4 to be a valid callback, no array or string given in %s on line %d 256NULL 257===DONE=== 258