I added a Location CCK field to an existing content type (Drupal 6.9). New nodes of this type seem to work fine, but if I edit an existing node, then add data to the Location CCK field, I receive the following error after saving the node (the location data does appear on the node) :

warning: array_filter() [function.array-filter]: The first argument should be an array in ../sites/all/modules/location/contrib/location_cck/location_cck.module on line 387.

warning: array_keys() [function.array-keys]: The first argument should be an array in ../sites/all/modules/location/contrib/location_cck/location_cck.module on line 387.

warning: Invalid argument supplied for foreach() in ../sites/all/modules/location/location.module on line 1657.

Any idea why this might be happening?

Comments

likewhoa’s picture

same issue here, but it only seems to be triggered when manually selecting a location marker and goes away when entering location manually in fields. It seems the marker is not being picked up for new nodes.

atelier’s picture

I found the following remarks on lines 297-301 of location_cck.module:

      // @@@ There is still a bug here!
      // If you go back and edit something, and you hadn't set a location the
      // first time, CCK fails to set up the defaults properly!
      // I'm just going to leave it like that for now, because I don't know how
      // to work around it.

I'm guessing this is related to the problem I'm having. Do you have an estimate of when this bug might be resolved?

Witch’s picture

same problem here

jjkiesch’s picture

Version: 6.x-3.x-dev » 6.x-3.1-rc1

i'm getting something similar. at first it was only when editing a previous node, but when trying to create a new node i get the same errors.


warning: array_filter() [function.array-filter]: The first argument should be an array in /Users/jjkiesch/Sites/maraconflict_com/public_html/sites/all/modules/location/contrib/location_cck/location_cck.module on line 385.
warning: array_keys() [function.array-keys]: The first argument should be an array in /Users/jjkiesch/Sites/maraconflict_com/public_html/sites/all/modules/location/contrib/location_cck/location_cck.module on line 385.
warning: Invalid argument supplied for foreach() in /Users/jjkiesch/Sites/maraconflict_com/public_html/sites/all/modules/location/location.module on line 1440.

jacerider’s picture

Have the same issue. Haven't found a solution yet.

vegasphotog’s picture

I think I have having the same issues....on my events calendar...everything was cool until either I added a new event or try to edit an older one.

Witch’s picture

updating to the latest dev version brings nothing:



    * warning: array_filter() [function.array-filter]: The first argument should be an array in /usr/www/users/tpkskh/modules/location/contrib/location_cck/location_cck.module on line 385.
    * warning: array_keys() [function.array-keys]: The first argument should be an array in /usr/www/users/tpkskh/modules/location/contrib/location_cck/location_cck.module on line 385.
    * warning: Invalid argument supplied for foreach() in /usr/www/users/tpkskh/modules/location/location.module on line 1440.

Anonymous’s picture

Title: Location CCK error when editing an existing node » Array errors in location_cck module
Version: 6.x-3.1-rc1 » 6.x-3.x-dev

I can confirm this error too.

I've marked the following issues as duplicates of this one:
#391810: Errors after using Location CCK
#393688: Error when updating a node whith location cck field
#402774: array errors

psynaptic’s picture

I have found this error just after installing custom_breadcrumbs. Disabling custom_breadcrumbs fixes the issue i.e. no error message appears.

psynaptic’s picture

Ok, it seemed to be fixed by removing custom_breadcrumbs but the errors are still coming. It seems to only happen on node save for me with the following errors:

warning: array_filter() [function.array-filter]: The first argument should be an array in /sites/all/modules/location/contrib/location_cck/location_cck.module on line 387.
warning: array_keys() [function.array-keys]: The first argument should be an array in /sites/all/modules/location/contrib/location_cck/location_cck.module on line 387.
warning: Invalid argument supplied for foreach() in /sites/all/modules/location/location.module on line 1657.
warning: array_filter() [function.array-filter]: The first argument should be an array in /sites/all/modules/location/contrib/location_cck/location_cck.module on line 387.
warning: array_keys() [function.array-keys]: The first argument should be an array in /sites/all/modules/location/contrib/location_cck/location_cck.module on line 387.
warning: Invalid argument supplied for foreach() in /sites/all/modules/location/location.module on line 1657.
matt v.’s picture

For what it's worth, similar errors get displayed when trying to work with location_cck nodes in Views.

jannalexx’s picture

same error after editing any node with location cck field
warning: array_filter() [function.array-filter]: The first argument should be an array in ...location_cck.module on line 385
warning: Invalid argument supplied for foreach() in ...location.module on line 1440.

andybounce’s picture

subscribing

hnln’s picture

subscribing

missym’s picture

subscribing

It looks like $type == 'field' and $object ->NULL and when array_filter tries to do something with $item['location_settings']['display']['hide'], it generates the error.

function location_cck_token_values($type, $object = NULL) {
if ($type == 'field') {
$item = $object[0];
$location = array(
'hide' => array_keys(array_filter($item['location_settings']['display']['hide'])),
'location' => location_load_location($item['lid']),
);

version = "6.x-3.1-rc1"
core = "6.x"
project = "location"
datestamp = "1236112547"

Peter Muusers’s picture

Changing line 386 from location_cck.module from:

'hide' => array_keys(array_filter($item['location_settings']['display']['hide'])),

to:

'hide' => (isset($item['location_settings'])) ? array_keys(array_filter($item['location_settings']['display']['hide'])) : array(),

and it solved the problem... instead of filling ['hide'] with null if there is no $item['location_settings'] present, it fills ['hide'] with an empty array...

andrewsuth’s picture

I get the same error but when using CCK Location when adding the field to a Views filter but the error is on a different line of code.

Here is the error message:

warning: array_filter() [function.array-filter]: The first argument should be an array in \sites\all\modules\location\contrib\location_cck\location_cck.module on line 348.

dunx’s picture

I had the same problem and only after turning on custom_breadcrumbs for this content type.

The above fix seemed to work... or at least the error has gone away.

missym’s picture

Status: Reviewed & tested by the community » Active

Many thanks, Peter!! That worked!

Edit --> Didn't work 100% - would work when I tried to save twice.

giggler’s picture

subscribe

andrewsuth’s picture

I hope this will this also be added to the next rc!

jannalexx’s picture

#16 didn't work here

leoklein’s picture

#16 worked for me. Not sure why but thanks.

mikeytown2’s picture

Status: Active » Reviewed & tested by the community
StatusFileSize
new562 bytes

taken from #16

Niko_K’s picture

Status: Active » Reviewed & tested by the community

Why should you use a

'hide' => (isset($item['location_settings'])) ? array_keys(array_filter($item['location_settings']['display']['hide'])) : array(),

here?
In my installation (i am using a location cck field) isset($item['location_settings']) is true, but array_filter($item['location_settings']['display']['hide']) is still null....

In my opinion the "fix" (in fact it is only hiding the error messages, i am not sure if it is really a fix) should look something like this:

'hide' => (isset($item['location_settings']['display']['hide'])) ? array_keys(array_filter($item['location_settings']['display']['hide'])) : array(),
phdhiren’s picture

Patch in #24 worked for me

halver’s picture

subscribe

Anonymous’s picture

Status: Reviewed & tested by the community » Needs work

Marking as 'needs work' as the provided patches don't fix the underlying problem.

I have a content type with location_cck fields - country*, province, city and coordinate chooser* (* = required). When I try to submit a node with a country and coordinates, I get the array errors and no location information is saved to the node.
Applying the above patches (specifically #25) removes the errors, but still no location data is saved to the node, hence the problem remains.
I can successfully save the node if I also set a province (though I shouldn't have to since province isn't required...)

Need to try and find/fix the underlying problem.

bdragon’s picture

Assigned: Unassigned » bdragon

able to reproduce. Looking into it.

bdragon’s picture

Status: Needs work » Needs review

OK, I think I found the issue. Could I get verification that this fixed it?

http://drupal.org/cvs?commit=192498
http://drupal.org/cvs?commit=192500

redijedi’s picture

subscribing

matt v.’s picture

I just tried uninstalling the Location module on my development site and reinstalling using the latest DEV version of Location instead. I'm still getting errors, when I view a CCK node with Location data associated with it:

    * warning: array_filter() [function.array-filter]: The first argument should be an array in C:\ . . . \sites\all\modules\location\contrib\location_cck\location_cck.module on line 389.
    * warning: array_keys() [function.array-keys]: The first argument should be an array in C:\ . . . \sites\all\modules\location\contrib\location_cck\location_cck.module on line 389.
    * warning: Invalid argument supplied for foreach() in C:\ . . . \sites\all\modules\location\location.module on line 1425.
matt v.’s picture

I took a queue from the patches in comment #30 above and tried adding the following at line #388:

      $item['location_settings']['display']['hide'] = array();

That seemed to take care of the error messages I was getting in comment #32 above.

Anonymous’s picture

Updated to latest .dev version - no more array errors, but still have issues with saving location data to node...

EDIT: I created a separate issue for the problems I'm having, in case it's not related to this issue... #424784: Location data not saved (when only have country filled in, and leave it as the default country) problem w location_strip()

yesct’s picture

marked #340994: array_filter() error as duplicate of this issue.

yesct’s picture

marked #416230: Location CCK field does not set default location as a duplicate of this issue

also tagging.

fletch11’s picture

Just tried the latest release and still getting the array errors as well.

ntt’s picture

subscribing

epicproblem1’s picture

subscribing, same problem

sgriffin’s picture

subscribing

Enfirno’s picture

subscribing

mikeytown2’s picture

Status: Needs review » Needs work

Latest Dev doesn't fix this. Error appearing on every page

array_filter() [function.array-filter]: The first argument should be an array in /sites/all/modules/location/contrib/location_cck/location_cck.module on line 389.

Here's that code block

      $location = array(
        'hide' => array_keys(array_filter($item['location_settings']['display']['hide'])),
        'location' => location_load_location($item['lid']),
      );

Original patch should still work... issue should be able to be replicated if your hiding some of the display fields. Alt to patch that I think might be more correct
http://drupal.org/comment/reply/373465#comment-1420184

yesct’s picture

Status: Needs work » Needs review

Try suggestion in #42
And post you results back. This will help review this.

drupalok’s picture

works for me

yesct’s picture

drupalok, which works for you, the original patch or the alternate one mentioned in #42?

droople’s picture

I get errors upon creating a node with cck_location field

warning: array_filter() [function.array-filter]: The first argument should be an array in D:\wamp\www\ta\sites\all\modules\location\contrib\location_cck\location_cck.module on line 389.
warning: array_keys() [function.array-keys]: The first argument should be an array in D:\wamp\www\ta\sites\all\modules\location\contrib\location_cck\location_cck.module on line 389.
warning: Invalid argument supplied for foreach() in D:\wamp\www\ta\sites\all\modules\location\location.module on line 1434.
steveadamo’s picture

im getting a similar error when trying to create a view, using the cck_location field... i think ive tried all the suggestions in this thread, but they all seem to be addressing a different line in the location_cck.module file...

my error code is:

warning: array_keys() [function.array-keys]: The first argument should be an array in C:\wamp\www\mysite\sites\all\modules\location\contrib\location_cck\location_cck.module on line 348.

and the entire block of code (from 346 - 364) is:

function theme_location_cck_formatter_default($element) {
  $field = content_fields($element['#field_name'], $element['#type_name']);
  $hide = array_keys(array_filter($field['location_settings']['display']['hide']));
  $location = $element['#item'];
  if (!empty($location['cck_preview_in_progress'])) {
    // Our canary field is in place, we are in a node preview.
    $fields = array();
    // If the delete location checkbox isn't checked, and the location isn't
    // "empty", then theme it based on the current state of the item.
    if (!location_is_empty($location, $fields) && empty($location['delete_location'])) {
      return theme('location', $location, $hide);
    }
  }
  else if (isset($location['lid']) && $location['lid']) {
    // "normal" viewing.
    // Location is already cached by CCK, so no need to load it.
    return theme('location', $location, $hide);
  }
}
steveadamo’s picture

I had previously tried #16 and #25, but hadnt tried the patch yet... unfortunately, the patch didnt address my problem...

droople’s picture

Just to clear a few things

The #24 patch works with Location 6.x-3.1-rc1 only. http://ftp.drupal.org/files/projects/location-6.x-3.1-rc1.tar.gz. To solve this error.

 * warning: array_filter() [function.array-filter]: The first argument should be an array in /usr/www/users/tpkskh/modules/location/contrib/location_cck/location_cck.module on line 385.
    * warning: array_keys() [function.array-keys]: The first argument should be an array in /usr/www/users/tpkskh/modules/location/contrib/location_cck/location_cck.module on line 385.
    * warning: Invalid argument supplied for foreach() in /usr/www/users/tpkskh/modules/location/location.module on line 1440.

However the latest dev as of May 2, has no working patch yet

steveadamo’s picture

thanks for the clarification... ill try installing/testing that version on my test site...

i have yet to see that particular error though (looks like there are fewer of us trying to call the location CCK field in a view?)...

steveadamo’s picture

well, i used the suggestions on the line in question (in my case, line 348), and i could successfully create a View (no error messages)... however, i was also not getting the location data pulled back (no map)... just a blank recordset...

i know the data is there, as im displaying it manually on another page (using the following PHP):

print $node->field_event_location[0]['street'] . '<br/>' . $node->field_event_location[0]['city'] . ' ' . $node->field_event_location[0]['province'] . ' ' . $node->field_event_location[0]['postal_code'] .'<br/><br/>'. (views_embed_view('event_address_other', 'block_1', $node->field_event_location[0]['lid']));

everything works there, with the exception of the view call... no GMAP is displayed (but all the other location fields are printed out)...

i wonder... does it matter that in my location_instance table, that i have 0's for nid, vid and uid? the only values i have (for the cck location records) are genid (cck:field_event_location:4) and lid (8).

droople’s picture

After applying patch #24 to Rc1, I tried building a view of a node type with a cck field. I got these two errors



    * user warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'DISTINCT(node.nid), node.created AS node_created, location.latitude AS gma' at line 1 query: SELECT COUNT(*) FROM (SELECT DISTINCT(node.nid) AS DISTINCT(node.nid), node.created AS node_created, location.latitude AS gmap_lat, location.longitude AS gmap_lon, node.type AS gmap_node_type FROM node node LEFT JOIN location_instance location_instance ON node.vid = location_instance.vid LEFT JOIN location location ON location_instance.lid = location.lid WHERE (node.status <> 0) AND (node.type in ('hair')) ORDER BY node_created ASC ) count_alias in /home/local/public_html/alpha/sites/all/modules/views/includes/view.inc on line 705.

    * user warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'DISTINCT(node.nid), node.created AS node_created, location.latitude AS gma' at line 1 query: SELECT DISTINCT(node.nid) AS DISTINCT(node.nid), node.created AS node_created, location.latitude AS gmap_lat, location.longitude AS gmap_lon, node.type AS gmap_node_type FROM node node LEFT JOIN location_instance location_instance ON node.vid = location_instance.vid LEFT JOIN location location ON location_instance.lid = location.lid WHERE (node.status <> 0) AND (node.type in ('hair')) ORDER BY node_created ASC LIMIT 0, 15 in /home/local/public_html/alpha/sites/all/modules/views/includes/view.inc on line 731.

I think I will go back to normal node locations. The only reason I wanted cck locations was the easy manipulation of where to show location fields in a form or node view without complex themeing.

nchase’s picture

got the same error but only when I'm using cck_locations together with cck_link. As soon as I delete the cck_link field everythings fine.

dirtabulous’s picture

I was having the same issues. The patch w/ updated from comment 25 appears to fix.
http://drupal.org/comment/reply/373465#comment-1420184

a25i’s picture

StatusFileSize
new12.83 KB
new868 bytes

Here's a patch that incorporates the change mentioned in #25. It's made against the 6.3 branch from CVS, and seems to suppress the errors that I was seeing.

To encourage testing, I've also attached a drop-in replacement of the location_cck.module file. Just remove the .txt, and copy over the existing location_cck.module file.

atelier’s picture

Thanks for packaging this patch into a module. I just tested on D6.10 and it worked perfectly. No errors.

Hopefully, this will make its way into an official release soon!

amcc’s picture

If i create a very simple node view displaying fields - then select the node title and Content: Location (i'm using a CCK location field) then i get the following error:
warning: array_filter() [function.array-filter]: The first argument should be an array in mysite/sites/all/modules/location/contrib/location_cck/location_cck.module on line 348.

If i limit the view to nodes that contain the location CCK field then that suppresses the error. I still get this with any version 3.0, 3.1 and dev with or without the location_cck.module.txt file from the previous post.

In addition - even when i limit to nodes with the location cck field the view isn't displaying the location info - if i go to the node that information gets displayed properly. E.g. If I put the country into the relevant location field in the node - it displays when i go to node/1 for instance. If i choose to display my CCK field for the location (content - field_location) nothing shows in the view, if I choose to display the location: country field nothing shows in the view

a25i’s picture

StatusFileSize
new1.38 KB
new12.89 KB

Let's try again...

Enfirno’s picture

Using the patch from #58, the warnings have been suppressed (as is the case with #55) however any "Hide Field" settings are now being ignored. That is, all fields (e.g., address, city, etc.) that contain data are displayed when viewing a location CCK field on a node.

a25i’s picture

StatusFileSize
new12.94 KB
new1.44 KB

Thanks for the review... That's what I get for not testing myself.

Okay this new patch partial fixes the problem, but I've uncovered what seems to be a different problem that I've added a new issue for http://drupal.org/node/463618.

elijah lynn’s picture

subscribing

giggler’s picture

thanks! error's gone...

nchase’s picture

patch #60 works for me. Thank you very much!

atelier’s picture

This is working for me, as well. What is the status for getting this patch committed?

yesct’s picture

Status: Needs review » Reviewed & tested by the community
techczech’s picture

subscribing

jinglesnbells’s picture

comment #60

I am still learning drupal. Where do I put the patch? Do I copy and paste it somewhere or just place the file in the location module?

Thanks for your help!

andrewsuth’s picture

Read the documentation here: http://drupal.org/patch/apply

Patching for the first time can be a little confusing so read the manual well.

GregoryHeller’s picture

I'm getting this error when a user tries to signup for a node that has the location cck field. I am using the signup module. There is no problem creating the nodes, or editing the nodes as far as i can tell, but when a user attempts to "signup" they get the error.

I am using drupal 6.12, Location 6.x.3.1-rc1, and signup 6.x-1.0-rc3

I have another content type that does not have a location field associated with it, and users can signup for it without incident or error.

andrewsuth’s picture

Make a new bug report for this module and make sure you post the error message. Unless you think it is directly related to the issue being discussed here.

GregoryHeller’s picture

I think that this is a related problem, the errors would appear to all be the same:
* warning: array_filter() [function.array-filter]: The first argument should be an array in /modules/contrib-pending/location/contrib/location_cck/location_cck.module on line 385.
* warning: array_keys() [function.array-keys]: The first argument should be an array in /modules/contrib-pending/location/contrib/location_cck/location_cck.module on line 385.
* warning: Invalid argument supplied for foreach() in /modules/contrib-pending/location/location.module on line 1440.

yesct’s picture

GregoryHeller, did you try the patch from #60?

summit’s picture

Subscribing, had same error, used patch on #60 and looking for new beta release.
greetings,
Martijn

GregoryHeller’s picture

Just tried the patch from #60 and it seems that it is working. no more errors from location_cck module on signup.

jamesmcd’s picture

Any plans for the patch being committed soon, now that we are receiving confirmations that it is solving the issue ?

Thanks

drew reece’s picture

The patch in #60 removes the errors for me. The patch file fails on hunk 2 for me with location 6.x-3.1-rc1, but using the whole module.txt file to replace the location_cck module worked.

Previously I had the following error…

warning: array_filter() [function.array-filter]: The first argument should be an array in sites/all/modules/location/contrib/location_cck/location_cck.module on line 385.
warning: array_keys() [function.array-keys]: The first argument should be an array in sites/all/modules/location/contrib/location_cck/location_cck.module on line 385.
warning: Invalid argument supplied for foreach() in sites/all/modules/location/location.module on line 1440.

held69’s picture

I'm using the latest Gmap 6.x-1.x-dev and Location 6.x-3.1-rc1, but get a little confused here.

Looking at this comment http://drupal.org/node/375259#comment-1735396 i get the feeling i dont need any patch here.

However in the following scenario i'm still getting errors:

-Both Gmap and Location CCK are configured to let users set lattitude and longitude data by using a Gmap.
-Users can also add a postal code

Now when i want to edit a node which has the lat. and long. + postalcode data under contentmanagement by putting a mark before the title and choosing for unpublish and click update i get:

    * warning: array_filter() [function.array-filter]: The first argument should be an array in /home/mysite/domains/mysite.com/public_html/sites/all/modules/location/contrib/location_cck/location_cck.module on line 385.
    * warning: array_keys() [function.array-keys]: The first argument should be an array in /home/mysite/domains/mysite.com/public_html/sites/all/modules/location/contrib/location_cck/location_cck.module on line 385.
    * warning: Invalid argument supplied for foreach() in /home/mysite/domains/mysite.com/public_html/sites/all/modules/location/location.module on line 1440.
sandino’s picture

subscribing

kevinquillen’s picture

#60 does not work for me. Using Location CCK with Organic Groups.

What should be done?

held69’s picture

I have applied the patch under #60.
It was the first time i applied a patch. I had the same failure as mentioned in #76.
I have applied the replacement mentioned under #76 as well.
Upontil now i didn't get the warnings mentioned under #77

For you out there who dont know how to patch.
This one helped me out: http://indiawebsearch.com/content/how-to-apply-a-patch-to-a-drupal-modul...

@gh0st25 have you applied the replacement mentioned under #77?

J-Chance’s picture

subscribing

yrre7’s picture

subscribing

mrgoltra’s picture

For those getting an error after patching. Have you tried to disable and enable the affected module?

johnmullin2003’s picture

subscribing ...

same issue

* warning: array_filter() [function.array-filter]: The first argument should be an array in /public_html/sites/all/modules/location/contrib/location_cck/location_cck.module on line 389.
* warning: array_keys() [function.array-keys]: The first argument should be an array in /public_html/sites/all/modules/location/contrib/location_cck/location_cck.module on line 389.
* warning: Invalid argument supplied for foreach() in /public_html/sites/all/modules/location/location.module on line 1434.

sagannotcarl’s picture

The patch in #60 is probably made against the dev version. If you are using the the release candidate it won't apply cleanly.

I'm using rc-1 so it didn't apply directly but by making the changes in the patch by hand my problem was solved.

johnmullin2003’s picture

I've still got the error in new today dev release.

Should I use the #60 patch?

any info is appreciated.

thanks!

merilainen’s picture

I applied #60 patch for latest dev-release and works well. It should be committed to dev.

I still get You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near &#039;4779219700615*COS(RADIANS(location_node_data_field_homelocation.latitude))*(0,91&#039 ... in file sites/all/modules/views/includes/view.inc

When this happens, the whole map won't load. Weird thing here is, that it works well on my dev-server, but when I commit changes to live-site, I get these SQL errors and maps load rarely.

R.Hendel’s picture

subscribe

kim.pepper’s picture

subscribe

yesct’s picture

Has anyone reviewed this patch? I'm wondering if the patch fixes the cause of the errors, or just stops them from being outputted.

I'm wondering if #511378: Reworked Location CCK module with GMap formatters might fix these errors.

samhassell’s picture

subscribing - manually applied the patch @ 60 and it seems to work.

mrgoltra’s picture

its back.

bdragon’s picture

Status: Reviewed & tested by the community » Needs review

Functionally equivalent patch to #60 committed as part of #511378: Reworked Location CCK module with GMap formatters.

(original message)
noahb patch committed.
http://drupal.org/cvs?commit=244004
http://drupal.org/cvs?commit=244006

johnmullin2003’s picture

Status: Needs review » Fixed

Today's New dev release has just fixed location_cck error !!!
Thanks all!

Status: Fixed » Closed (fixed)

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

lugha’s picture

subscribing

kohashi’s picture

just downloaded and installed everything today... got that 348 line error. placed patch 60 and things just don't save.

wintervanilla’s picture

Subscribe -- These three errors have have surfaced on our site recently as well. Every instance of the error on our site occurs when accessing a particular content type (press release) within the site.

    * warning: array_filter() [function.array-filter]: The first argument should be an array in /home2/mesaprog/public_html/sites/all/modules/location/contrib/location_cck/location_cck.module on line 385.
    * warning: array_keys() [function.array-keys]: The first argument should be an array in /home2/mesaprog/public_html/sites/all/modules/location/contrib/location_cck/location_cck.module on line 385.
    * warning: Invalid argument supplied for foreach() in /home2/mesaprog/public_html/sites/all/modules/location/location.module on line 1440.

I don't know how to confirm this, but I found that in the content type settings, I had the maximum locations set at 0, and the minimum set at 1. This seems like enough of a contradiction to make a computer angry, right? Now that I've set the minimum to 0 as well... the error has not gone away. This could be entirely unrelated but I wanted to mention it to get some helpful feedback.

Cheers,
Andrew

diffstrat’s picture

subscribing

redben’s picture

Status: Closed (fixed) » Active

Reopened. This still seems to be an issue. For me the warning show up when using custom breadcrumbs module

uomeds’s picture

Just got this as well.

uomeds’s picture

Wow well that was easy. Applied

'hide' => (isset($item['location_settings']['display']['hide'])) ? array_keys(array_filter($item['location_settings']['display']['hide'])) : array(),

to line 385 of location_cck.module and it's fixed. Still storing and retrieving locations okay. This is with drupal 6.14 location 3.1-rc1.

Thanks.

zach harkey’s picture

I'm getting the same line 385 error whenever I have the custom_pagers module enabled. When I disable the module, the error goes away.

Architeck’s picture

I can confirm the fix posted in [#102] works to rid the errors mentioned above and from this issue http://drupal.org/node/633048.

Only thing to note is a typo in the instructions.

Make this change on line 385 in location/contrib/location_cck/location_cck.module, not line 285.

Thanks to uomeds for posting the fix.

boftx’s picture

subscribe

boftx’s picture

The problem referred in #51 is also happening for me, is it caused by applying the patch? or is it related at all to this issue?

Aniara.io’s picture

Subscribing

chosig’s picture

#102 fixed it for me.

subscribing

nickl’s picture

Status: Active » Reviewed & tested by the community

This has gone on for far too long. Many patches have been broad forward, many users had success, reviewing them, even more users have only subscribed. We are better of closing this leg and starting of new.

Marked as reviewed and tested - please someone confirm this is fixed and start new issues fpr array problems.

AmberJoy-1’s picture

subscribe, having same problem.

bdragon’s picture

Err, wasn't the patch already applied to -dev? Why is this issue open again?

GeekyLass’s picture

Error:

warning: array_filter() [function.array-filter]: The first argument should be an array in /home/kristina/qwodev/sites/all/modules/location/contrib/location_cck/location_cck.module on line 385.
warning: array_keys() [function.array-keys]: The first argument should be an array in /home/kristina/qwodev/sites/all/modules/location/contrib/location_cck/location_cck.module on line 385.
warning: Invalid argument supplied for foreach() in /home/kristina/qwodev/sites/all/modules/location/location.module on line 1440.

I have the events module and the sign up module. I have a location field on my events node. The error occurred when I signed up for an event.

I figured since the error points specifically at the location module, and that it matches the errors posted here that it was appropriate to inform you of the error.

Location 6.x-3.1-rc1
CCK 6.x-3.x-dev
Event 6.x-2.x-dev
Sign Up 6.x-1.0-rc6
Drupal 6.15

Aniara.io’s picture

#102 fixed it for me too.

redben’s picture

Is this patch going to be committed any time soon ?

ultimike’s picture

#102 worked for me as well...

-mike

jeffschuler’s picture

Status: Reviewed & tested by the community » Fixed

As bdragon suggests in #111 this was fixed in 6.x-3.x-dev back in July 2009, see #94.

It would be great to see this incorporated into a stable release: Locations' latest release (6.x-3.1-rc1) is from 2009-Mar-03 and recommended version, 2008-Dec-12.

@redben, (who re-opened this issue in #100,) what version of location are you using?

redben’s picture

@jeffschuler i am using location cck 6.x-3.1-rc1 !
I'll try the dev version as you suggest

Thanks

Status: Fixed » Closed (fixed)

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

ari-meetai’s picture

#102 fixed it for me on fresh 6.x-3.1-rc1. Agreed with #116 (It would be great to see this incorporated into a stable release: Locations' latest release (6.x-3.1-rc1) is from 2009-Mar-03 and recommended version, 2008-Dec-12.).

summit’s picture

Hi,
Could someone make a patch of #102 please?
greetings, Martijn

shaisachs’s picture

Status: Closed (fixed) » Reviewed & tested by the community
StatusFileSize
new577 bytes

Here's a patch containing the fix in #102. Seems to work fine!

Anonymous’s picture

I'm using 6.x-3.1-rc1 and I still get this error:

# warning: array_filter() [function.array-filter]: The first argument should be an array in /var/www/sites/all/modules/location/contrib/location_cck/location_cck.module on line 385.

I incorporated the patch at #121 and that fixed it.

@bdragon: Looks like that patch is not in rc1 ...

m.sant’s picture

updating to location-6.x-3.x-dev fixed the problem for me

jfox77’s picture

I updated to location-6.x-3.x-dev and am still seeing the problem with the warning messages.

* warning: array_filter() [function.array-filter]: The first argument should be an array in /mnt/stor1-wc2-dfw1/456314/mysite.com/web/content/sites/all/modules/admin_menu/location/contrib/location_cck/location_cck.module on line 385.
* warning: array_keys() [function.array-keys]: The first argument should be an array in /mnt/stor1-wc2-dfw1/456314/mysite.com/web/content/sites/all/modules/admin_menu/location/contrib/location_cck/location_cck.module on line 385.
* warning: Invalid argument supplied for foreach() in /mnt/stor1-wc2-dfw1/456314/mysite.com/web/content/sites/all/modules/admin_menu/location/location.module on line 1440.

Thanks in advanced for your help!

danny englander’s picture

I applied the patch from #121 in 6.x-3.1-rc1, confirmed the patch had updated the code and this fixed the issue.

summit’s picture

Hi,
What is the right order to get the patch working for .dev?
greetings, Martijn

Anonymous’s picture

@Summit, perhaps I don't understand your question but for a patch there is no 'order'. Just run patch -p0 < patchfilename, the patch command takes cares of the rest.

If you're talking about the patch at #121 run that command from the same dir where location_cck.module is located.

summit’s picture

Hi,
I mean if the RC1 candidate has other code then 3.x-dev, then the
- code could not be correct anymore, then the patch isn;t working right?
So is the patch against RC1? then it could be a problem to file the patch against latest 3.x-dev?
May be I am not correct, I mostly patch manually. Then I am sorry for this remark.
greetings, Martijn

ankur’s picture

Status: Reviewed & tested by the community » Closed (fixed)

Re-closing.

This thing was fixed by the commit mentioned in #93. If you use the latest 6.3.x dev snapshot (or any of the DRUPAL-6--3 snapshots since the commit last July), you will NOT have this error. If, however, you're using 6.3.1-RC1, put out in March before the commit, then you *will* have this bug.

myst.riven’s picture

Just tried the solution from Peter in #16 and the error is now gone. Thanks Peter!

seanr’s picture

Status: Closed (fixed) » Active

OK, so why the heck doesn't someone actually post a RELEASE that fixes this? Drush gets the latest release whether it's a stable point release or a release candidate, so there could be hundreds of sites using the old buggy release because of that. Please at least get an RC2 posted ASAP.

yesct’s picture

Status: Active » Closed (fixed)

re closing (unless I misunderstand something).
@seanr you have good points, but best to put them in a different issue... like #664472: [master] Release of Location 6.x-3.1?

dreadfulcode’s picture

Forget the patches.

As of today, may 4th, 2010,

I can confirm that using the latest dev release of location, in conjunction with the latest dev release of Gmap, work like peas and carrots.

strae’s picture

subscribe.
rc1 still have that error, im downloading the 3.x.dev

sheldon rampton’s picture

I experienced the issue today; applying the patch in #121 fixed the issue.

PeterDropCL’s picture

#24 work cool for me
thanks