On the top of the settings/gmaps page i get this error.

warning: Invalid argument supplied for foreach() in C:\xampp\htdocs\modules\gmaps\gmaps.module on line 1653.

this line is :

//apply translations
foreach($units as $key => $info) {

warning: Invalid argument supplied for foreach() in C:\xampp\htdocs\modules\gmaps\includes\gmaps.admin.inc on line 798.

this line is :

foreach(gmaps_length_get_units() as $key => $info) {

Also if I try to edit any of the map presets I get this error message:

warning: Parameter 2 to gmaps_map_form() expected to be a reference, value given in C:\xampp\htdocs\includes\form.inc on line 372

this line is:

$form = call_user_func_array(isset($callback) ? $callback : $form_id, $args);

By the looks of this, it seems that $key is not being correctly called. However i've double checked the API key, and ive tried using Keys module to see if that makes a different.

I had Gmap module installed when i installed Gmaps tools, but have since deleted and reinstalled everything, could this be causing an effect?

Could there be something in the SQL database causing this?

Also, im running an offline server, can this cause this malfuntion?

Comments

xmarket’s picture

Well, the first belongs to length units not to the API key. For some reason, it seems there are no length units on your instance, which is very strange, because there are two hardcoded (meter and foot). If you changed anything to the resources/length.units.info file, then it can cause the error. In this case you should fix the file or revert the changes, then clear your caches before you visit the settings page.

The second (parameter 2...) is strange, too, because it can occur only, when you try to add a new preset.

volocuga’s picture

Getting same as "warning: Invalid argument supplied for foreach() in C:\xampp\htdocs\modules\gmaps\gmaps.module on line 1653." upon installation Gmaps 6.2 dev

xmarket’s picture

Do you use any cache related modules?

astro87’s picture

I have the same "warning: Invalid argument supplied for foreach() in C:\strony_www\PHP\xampp\htdocs\drupal-6.16\modules\gmaps\gmaps.module on line 1653"

if this is important I install gmaps after installing gmap module which also not work properly.

xmarket’s picture

Status: Active » Fixed
wrd’s picture

I'm still getting this error in 6.x-2.1. The dev release generates the same error, but on line 1655.

Status: Fixed » Closed (fixed)

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

Harald.Winzer’s picture

Hello,

I also get the problem.

warning: Invalid argument supplied for foreach() in C:\xampp\htdocs\test\sites\all\modules\gmaps\gmaps.module on line 1655.

Help, please

Harald.Winzer’s picture

Status: Closed (fixed) » Active

reopening

sourabh.iitm’s picture

Version: 6.x-2.0-beta4 » 6.x-2.x-dev

I installed version 6.x 2.1 and i was getting the error for C:\xampp\htdocs\modules\gmaps\gmaps.module on line 1653

So i updated it to 6.x 2.x (11 July) So my error changed to C:\xampp\htdocs\modules\gmaps\gmaps.module on line 1655.

Something to do with xampp?

CardEra’s picture

Also getting the same error - but is probably some issue with either my XAMPP version or module incomaptibility.
I installed on another machine with fewer modules and it worked fine.

Anyone have any ideas - I'll start removing modules to see what works...

ES.Bill’s picture

Also having the same error. I've installed on two other machines in the past using XAMPP , one with quite a number of modules installed without any problems. I've kept the two machines up to date with no problems, but with a new install started getting errors.

I'm starting to do comparisons and uninstalling modules to also see what works.

ES.Bill’s picture

After uninstalling a large number of modules with no change in warnings I upgraded from XAMPP 1.7.2 to 1.7.3 with no change. I then went back to XAMPP 1.7.1 and warnings disappeared. Have reloaded modules and everything looks fine. Looks like a version problem with Apache or PHP.

xmarket’s picture

It looks like a PHP incompatibility. Can you post the PHP versions where the problem occurs?

sean-gnu’s picture

Commenting out the caching code and clearing the drupal cache a few times seems to fix this :

from line 1644 of gmaps.module :

/*if no reset required, then try to use cached content
if (!$reset && ($cached = cache_get('gmaps_length_units', 'cache'))) {
$units = $cached->data;
}
else {*/
$units = _gmaps_call_func('gmaps', 'admin', '_gmaps_length_get_units');
/* } */