Kohana提供的参数无效

I have found the following error, please tell me how i can correct this error.

ErrorException [ 2 ]: Invalid argument supplied for foreach() ~ APPPATH/kohana/system/classes/Kohana/Arr.php [ 452 ]

Obviously, supply a valid argument :) To properly answer you question you and I need to know what argument you are supplying. So do a var_dump of the variable just before the foreach-loop to find out.

A common mistake made is passing an empty or non-array variable. Put an if-statement around the foreach as a simple solution like this:

if($bar){
 foreach($bar as $foo){
  //your code
 }
}