I received the following warning after enabling the navigation module:
warning: Invalid argument supplied for foreach() in /drupal/sites/all/modules/navigate/navigate_search/navigate_search.module on line 253.
warning: Invalid argument supplied for foreach() in /drupal/sites/all/modules/navigate/navigate_search/navigate_search.module on line 253.

Comments

pnigro’s picture

I experienced the same thing.

markhalliwell’s picture

Status: Active » Postponed (maintainer needs more info)

Is this still the case? I will need a little more information so I can track this down if it is. I have not seen any issues when enabling/installing the dev version of this module. Perhaps your can try uninstalling the module after you disable it. Then reinstall it. This will delete navigates tables from your database and install new ones.

briandmiller’s picture

Component: Code » Code (PHP)

I had this too. Tried disabling, uninstalling, updating to latest dev and reinstalling. Still get the same error.

markhalliwell’s picture

Have you tried installing Navigate (the module) first and then installing the widgets? I am still trying to figure out what could be happening.

marthus’s picture

I received the following warning after enabling the navigation module:
warning: Invalid argument supplied for foreach() in /drupal/sites/all/modules/navigate/navigate_search/navigate_search.module on line 253.

I tried to reinstall and no good. I see that others have had it but I can't find a resolution posted. Is there a fix?

marthus’s picture

I don't know why but I just got it all to work and the Warning message is gone. After installing and uninstalling the dev version three times to no avail (enabling, running PHP and Cron each time) what I thought to do was uninstall it again and then I installed the beta6 version. I still got the Warning message above when I enabled the beta6 module; however, I then updated the beta6 module to the dev version ( installed the dev over the beta6) ran PHP update and Cron and everything works fine! I'm not a programmer so I've no idea why it worked or if it was a coincidence but I'm just excited that it works as the module is really awesome. Thanks!

amitgoyal’s picture

Status: Postponed (maintainer needs more info) » Fixed

There are no such errors in 6.x-1.0 so marking this fixed.

frederickjh’s picture

Version: 6.x-1.x-dev » 6.x-1.0
Status: Fixed » Active

I am getting this same message from drush when I enable or disable other modules. It always is repeated three times.

Invalid argument supplied for foreach() navigate_search.module:253 [warning]
Invalid argument supplied for foreach() navigate_search.module:253 [warning]
Invalid argument supplied for foreach() navigate_search.module:253 [warning]

Navigate Module info from drush:

Extension : navigate
Project : navigate
Type : module
Title : Navigate
Description : Adds a framework for supplying navigation tools to Drupal
Version : 6.x-1.0
Package : Navigate
Core : 6.x
PHP : 4.3.5
Status : enabled
Path : sites/all/modules/navigate
Schema version : 1
Requires : none
Required by : navigate_custom, navigate_favorites, navigate_menu, navigate_search

Please contact me if you need more information to correct this but my guess is that there is something no right about the foreach() statement.

You might find these links helpful in solving this problem.

PHP Warning: Invalid argument supplied for foreach()
Invalid argument supplied for foreach()
foreach on php.net

Lines 248-257 of navigate_search.module

function navigate_search_search() {
  global $_navigate_search_matches;
  $output = '';
  $settings = navigate_widget_settings_get($_POST['wid']);

  foreach ($settings as $key => $val) {
    if (strpos($key, 'content_type_') !== FALSE && $val == 1) {
      $types[] = str_replace('content_type_', '', $key);
    }
  }

My PHP is not that strong but could it be that you are not declaring $settings as an array before the foreach() ?

amitgoyal’s picture

Status: Active » Fixed

Thanks @frederickjh for filing and explaining the issue in detail. We have added the extra checks to fix this issue. You can download 6.x-1.x-dev now to get the updated code and we will release 6.x-1.1 later.

Status: Fixed » Closed (fixed)

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