1--TEST-- 2Foreach loop tests - error case: not an array. 3--FILE-- 4<?php 5echo "\nNot an array.\n"; 6$a = TRUE; 7foreach ($a as $v) { 8 var_dump($v); 9} 10 11$a = null; 12foreach ($a as $v) { 13 var_dump($v); 14} 15 16$a = 1; 17foreach ($a as $v) { 18 var_dump($v); 19} 20 21$a = 1.5; 22foreach ($a as $v) { 23 var_dump($v); 24} 25 26$a = "hello"; 27foreach ($a as $v) { 28 var_dump($v); 29} 30 31echo "done.\n"; 32?> 33--EXPECTF-- 34Not an array. 35 36Warning: Invalid argument supplied for foreach() in %s on line 4 37 38Warning: Invalid argument supplied for foreach() in %s on line 9 39 40Warning: Invalid argument supplied for foreach() in %s on line 14 41 42Warning: Invalid argument supplied for foreach() in %s on line 19 43 44Warning: Invalid argument supplied for foreach() in %s on line 24 45done. 46