Warning: Invalid argument supplied for foreach() in views_php_handler_filter->php_post_execute() I've created a view block with views3. 
When I attach the views block to a node, I want to know if the node is sticky and if the content type is "lodging".
If the criteria are met, do not display view result.

In the views filter (php field) I've created the following code.

if (arg(0) == 'node') {
  $nid = arg(1);
  $node = node_load($nid); // get node id
}
$sticky_status = $node-&gt;sticky;  //  get sticky status
$node_type = $node-&gt;type;  // get node type
if ($sticky_status == '1' &amp;&amp; $node_type == 'lodging') // condition if sticky is 1 (active) and node type is "lodging"
{
  $view-&gt;result = null;  // do not display views
}


The code is working fine and I get the desired result, however I also get the following warning message:

Warning: Invalid argument supplied for foreach() in views_php_handler_filter-&gt;php_post_execute() (line 84 of /var/www/html/planetlodge/sites/all/modules/views_php/plugins/views/views_php_handler_filter.inc).
Warning: array_slice() expects parameter 1 to be array, null given in views_php_plugin_pager-&gt;post_execute() (line 46 of /var/www/html/planetlodge/sites/all/modules/views_php/plugins/views/views_php_plugin_pager.inc).
Warning: array_values() expects parameter 1 to be array, null given in view-&gt;execute() (line 1155 of /var/www/html/planetlodge/sites/all/modules/views/includes/view.inc).


Where is the error in the code ?
The error is here:

$view-&gt;result = null;


Try changing it to:

$view-&gt;result = array();


Views is running over the $view-&gt;result var as an array without checking its type, but it's always expecting an array. As NULL isn't an array it complains, but it's just a Warning so the script continues. Because the results loop has failed you get the same effect as when the array is empty, and as you say everything works as expected.