1--TEST-- 2filter_var_array() and different arguments 3--SKIPIF-- 4<?php if (!extension_loaded("filter")) print "skip"; ?> 5--FILE-- 6<?php 7 8echo "-- (1)\n"; 9var_dump(filter_var_array(NULL)); 10var_dump(filter_var_array(array())); 11var_dump(filter_var_array(array(1,"blah"=>"hoho"))); 12var_dump(filter_var_array(array(), -1)); 13var_dump(filter_var_array(array(), 1000000)); 14var_dump(filter_var_array(array(), "")); 15 16echo "-- (2)\n"; 17var_dump(filter_var_array(array(""=>""), -1)); 18var_dump(filter_var_array(array(""=>""), 1000000)); 19var_dump(filter_var_array(array(""=>""), "")); 20 21echo "-- (3)\n"; 22var_dump(filter_var_array(array("aaa"=>"bbb"), -1)); 23var_dump(filter_var_array(array("aaa"=>"bbb"), 1000000)); 24var_dump(filter_var_array(array("aaa"=>"bbb"), "")); 25 26echo "-- (4)\n"; 27var_dump(filter_var_array(array(), new stdclass)); 28var_dump(filter_var_array(array(), array())); 29var_dump(filter_var_array(array(), array("var_name"=>1))); 30var_dump(filter_var_array(array(), array("var_name"=>-1))); 31var_dump(filter_var_array(array("var_name"=>""), array("var_name"=>-1))); 32 33echo "-- (5)\n"; 34var_dump(filter_var_array(array("var_name"=>""), array("var_name"=>-1, "asdas"=>"asdasd", "qwe"=>"rty", ""=>""))); 35var_dump(filter_var_array(array("asdas"=>"text"), array("var_name"=>-1, "asdas"=>"asdasd", "qwe"=>"rty", ""=>""))); 36 37 38$a = array(""=>""); $b = -1; 39var_dump(filter_var_array($a, $b)); 40var_dump($a, $b); 41 42$a = array(""=>""); $b = 100000; 43var_dump(filter_var_array($a, $b)); 44var_dump($a, $b); 45 46$a = array(""=>""); $b = ""; 47var_dump(filter_var_array($a, $b)); 48var_dump($a, $b); 49 50echo "Done\n"; 51?> 52--EXPECTF-- 53-- (1) 54 55Warning: filter_var_array() expects parameter 1 to be array, null given in %s on line %d 56NULL 57array(0) { 58} 59array(2) { 60 [0]=> 61 string(1) "1" 62 ["blah"]=> 63 string(4) "hoho" 64} 65bool(false) 66bool(false) 67bool(false) 68-- (2) 69bool(false) 70bool(false) 71bool(false) 72-- (3) 73bool(false) 74bool(false) 75bool(false) 76-- (4) 77bool(false) 78array(0) { 79} 80array(1) { 81 ["var_name"]=> 82 NULL 83} 84array(1) { 85 ["var_name"]=> 86 NULL 87} 88array(1) { 89 ["var_name"]=> 90 string(0) "" 91} 92-- (5) 93 94Warning: filter_var_array(): Empty keys are not allowed in the definition array in %s on line %d 95bool(false) 96 97Warning: filter_var_array(): Empty keys are not allowed in the definition array in %s on line %d 98bool(false) 99bool(false) 100array(1) { 101 [""]=> 102 string(0) "" 103} 104int(-1) 105bool(false) 106array(1) { 107 [""]=> 108 string(0) "" 109} 110int(100000) 111bool(false) 112array(1) { 113 [""]=> 114 string(0) "" 115} 116string(0) "" 117Done 118