1--TEST-- 2Test getimagesize() function : usage variations - unexpected type for arg 2 3--FILE-- 4<?php 5function test_error_handler($err_no, $err_msg, $filename, $linenum) { 6 echo "Error: $err_no - $err_msg\n"; 7} 8set_error_handler('test_error_handler'); 9 10echo "*** Testing getimagesize() : usage variations ***\n"; 11 12// Initialise function arguments not being substituted (if any) 13$imagefile = __DIR__."/test1pix.jpg"; 14 15//get an unset variable 16$unset_var = 10; 17unset ($unset_var); 18 19//array of values to iterate over 20$values = array( 21 22 // int data 23 "0" => 0, 24 "1" => 1, 25 "12345" => 12345, 26 "-2345" => -2345, 27 28 // float data 29 "10.5" => 10.5, 30 "-10.5" => -10.5, 31 "10.1234567e5" => 10.1234567e10, 32 "10.7654321e-5" => 10.7654321E-5, 33 .5, 34 35 // array data 36 "array()" => array(), 37 "array(0)" => array(0), 38 "array(1)" => array(1), 39 "array(1, 2)" => array(1, 2), 40 "array('color' => 'red', 'item' => 'pen')" => array('color' => 'red', 'item' => 'pen'), 41 42 // null data 43 "NULL" => NULL, 44 "null" => null, 45 46 // boolean data 47 "true" => true, 48 "false" => false, 49 "TRUE" => TRUE, 50 "FALSE" => FALSE, 51 52 // empty data 53 "\"\"" => "", 54 "''" => '', 55 56 // object data 57 "new stdclass()" => new stdclass(), 58 59 // undefined data 60 "undefined_var" => $undefined_var, 61 62 // unset data 63 "unset_var" => $unset_var, 64); 65 66// loop through each element of the array for info 67 68foreach($values as $key => $value) { 69 echo "\n-- Arg value $key --\n"; 70 getimagesize($imagefile, $value); 71 var_dump(bin2hex($value["APP0"])); 72}; 73 74?> 75--EXPECT-- 76*** Testing getimagesize() : usage variations *** 77Error: 2 - Undefined variable $undefined_var 78Error: 2 - Undefined variable $unset_var 79 80-- Arg value 0 -- 81string(28) "4a46494600010201006000600000" 82 83-- Arg value 1 -- 84string(28) "4a46494600010201006000600000" 85 86-- Arg value 12345 -- 87string(28) "4a46494600010201006000600000" 88 89-- Arg value -2345 -- 90string(28) "4a46494600010201006000600000" 91 92-- Arg value 10.5 -- 93string(28) "4a46494600010201006000600000" 94 95-- Arg value -10.5 -- 96string(28) "4a46494600010201006000600000" 97 98-- Arg value 10.1234567e5 -- 99string(28) "4a46494600010201006000600000" 100 101-- Arg value 10.7654321e-5 -- 102string(28) "4a46494600010201006000600000" 103 104-- Arg value 12346 -- 105string(28) "4a46494600010201006000600000" 106 107-- Arg value array() -- 108string(28) "4a46494600010201006000600000" 109 110-- Arg value array(0) -- 111string(28) "4a46494600010201006000600000" 112 113-- Arg value array(1) -- 114string(28) "4a46494600010201006000600000" 115 116-- Arg value array(1, 2) -- 117string(28) "4a46494600010201006000600000" 118 119-- Arg value array('color' => 'red', 'item' => 'pen') -- 120string(28) "4a46494600010201006000600000" 121 122-- Arg value NULL -- 123string(28) "4a46494600010201006000600000" 124 125-- Arg value null -- 126string(28) "4a46494600010201006000600000" 127 128-- Arg value true -- 129string(28) "4a46494600010201006000600000" 130 131-- Arg value false -- 132string(28) "4a46494600010201006000600000" 133 134-- Arg value TRUE -- 135string(28) "4a46494600010201006000600000" 136 137-- Arg value FALSE -- 138string(28) "4a46494600010201006000600000" 139 140-- Arg value "" -- 141string(28) "4a46494600010201006000600000" 142 143-- Arg value '' -- 144string(28) "4a46494600010201006000600000" 145 146-- Arg value new stdclass() -- 147string(28) "4a46494600010201006000600000" 148 149-- Arg value undefined_var -- 150string(28) "4a46494600010201006000600000" 151 152-- Arg value unset_var -- 153string(28) "4a46494600010201006000600000" 154