Download & Extend

Invalid argument for foreach on boost.module line 513

Project:Boost
Version:6.x-1.0-beta1
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed (fixed)

Issue Summary

In boost_cache_expire_derivative(), the following code:

  #path redirects
  if (module_exists('path_redirect')){
    $path_redirects = boost_path_redirect_load(array('redirect' => $path));
  }

  #flush caches
  boost_cache_expire($path_alias, $wildcard);
  foreach($path_redirects as $path_redirect) {
    boost_cache_expire($path_redirect['path'], $wildcard );
  }

Results in "warning: Invalid argument supplied for foreach() in /www/beta4/httpdocs/sites/all/modules/boost/boost.module on line 513"

if the path_redirect module is not installed.

To fix, initialize $path_redirects to an empty array or wrap the foreach in an "if (isset(..."

See patch for latter solution.

AttachmentSize
boost.invalidargument.patch551 bytes

Comments

#1

Status:active» reviewed & tested by the community

Tested & looks good. Thanks for supplying the patch!

#2

Status:reviewed & tested by the community» fixed

committed

#3

Hi,

confirming the issue in Drupal 6.12 with 6.x-1.0-beta1. The patch applies cleanly and works as advertised.

Thanks & greetings, -asb

#4

Status:fixed» closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.