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
Comment #1
likewhoa commentedsame 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.
Comment #2
atelier commentedI found the following remarks on lines 297-301 of location_cck.module:
I'm guessing this is related to the problem I'm having. Do you have an estimate of when this bug might be resolved?
Comment #3
Witch commentedsame problem here
Comment #4
jjkiesch commentedi'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.
Comment #5
jacerider commentedHave the same issue. Haven't found a solution yet.
Comment #6
vegasphotog commentedI 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.
Comment #7
Witch commentedupdating to the latest dev version brings nothing:
Comment #8
Anonymous (not verified) commentedI 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
Comment #9
psynaptic commentedI have found this error just after installing custom_breadcrumbs. Disabling custom_breadcrumbs fixes the issue i.e. no error message appears.
Comment #10
psynaptic commentedOk, 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:
Comment #11
matt v. commentedFor what it's worth, similar errors get displayed when trying to work with location_cck nodes in Views.
Comment #12
jannalexx commentedsame 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.
Comment #13
andybounce commentedsubscribing
Comment #14
hnln commentedsubscribing
Comment #15
missym commentedsubscribing
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"
Comment #16
Peter Muusers commentedChanging 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...
Comment #17
andrewsuth commentedI 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.
Comment #18
dunx commentedI 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.
Comment #19
missym commentedMany thanks, Peter!! That worked!
Edit --> Didn't work 100% - would work when I tried to save twice.
Comment #20
giggler commentedsubscribe
Comment #21
andrewsuth commentedI hope this will this also be added to the next rc!
Comment #22
jannalexx commented#16 didn't work here
Comment #23
leoklein commented#16 worked for me. Not sure why but thanks.
Comment #24
mikeytown2 commentedtaken from #16
Comment #25
Niko_K commentedWhy should you use a
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:
Comment #26
phdhiren commentedPatch in #24 worked for me
Comment #27
halver commentedsubscribe
Comment #28
Anonymous (not verified) commentedMarking 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.
Comment #29
bdragon commentedable to reproduce. Looking into it.
Comment #30
bdragon commentedOK, 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
Comment #31
redijedi commentedsubscribing
Comment #32
matt v. commentedI 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:
Comment #33
matt v. commentedI took a queue from the patches in comment #30 above and tried adding the following at line #388:
That seemed to take care of the error messages I was getting in comment #32 above.
Comment #34
Anonymous (not verified) commentedUpdated 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()
Comment #35
yesct commentedmarked #340994: array_filter() error as duplicate of this issue.
Comment #36
yesct commentedmarked #416230: Location CCK field does not set default location as a duplicate of this issue
also tagging.
Comment #37
fletch11 commentedJust tried the latest release and still getting the array errors as well.
Comment #38
ntt commentedsubscribing
Comment #39
epicproblem1 commentedsubscribing, same problem
Comment #40
sgriffin commentedsubscribing
Comment #41
Enfirno commentedsubscribing
Comment #42
mikeytown2 commentedLatest Dev doesn't fix this. Error appearing on every page
Here's that code block
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
Comment #43
yesct commentedTry suggestion in #42
And post you results back. This will help review this.
Comment #44
drupalok commentedworks for me
Comment #45
yesct commenteddrupalok, which works for you, the original patch or the alternate one mentioned in #42?
Comment #46
droople commentedI get errors upon creating a node with cck_location field
Comment #47
steveadamo commentedim 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:
and the entire block of code (from 346 - 364) is:
Comment #48
steveadamo commentedI had previously tried #16 and #25, but hadnt tried the patch yet... unfortunately, the patch didnt address my problem...
Comment #49
droople commentedJust 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.
However the latest dev as of May 2, has no working patch yet
Comment #50
steveadamo commentedthanks 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?)...
Comment #51
steveadamo commentedwell, 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):
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).
Comment #52
droople commentedAfter applying patch #24 to Rc1, I tried building a view of a node type with a cck field. I got these two errors
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.
Comment #53
nchase commentedgot 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.
Comment #54
dirtabulous commentedI was having the same issues. The patch w/ updated from comment 25 appears to fix.
http://drupal.org/comment/reply/373465#comment-1420184
Comment #55
a25i commentedHere'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.
Comment #56
atelier commentedThanks 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!
Comment #57
amcc commentedIf 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
Comment #58
a25i commentedLet's try again...
Comment #59
Enfirno commentedUsing 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.
Comment #60
a25i commentedThanks 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.
Comment #61
elijah lynnsubscribing
Comment #62
giggler commentedthanks! error's gone...
Comment #63
nchase commentedpatch #60 works for me. Thank you very much!
Comment #64
atelier commentedThis is working for me, as well. What is the status for getting this patch committed?
Comment #65
yesct commentedComment #66
techczech commentedsubscribing
Comment #67
jinglesnbells commentedcomment #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!
Comment #68
andrewsuth commentedRead the documentation here: http://drupal.org/patch/apply
Patching for the first time can be a little confusing so read the manual well.
Comment #69
GregoryHeller commentedI'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.
Comment #70
andrewsuth commentedMake 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.
Comment #71
GregoryHeller commentedI 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.
Comment #72
yesct commentedGregoryHeller, did you try the patch from #60?
Comment #73
summit commentedSubscribing, had same error, used patch on #60 and looking for new beta release.
greetings,
Martijn
Comment #74
GregoryHeller commentedJust tried the patch from #60 and it seems that it is working. no more errors from location_cck module on signup.
Comment #75
jamesmcd commentedAny plans for the patch being committed soon, now that we are receiving confirmations that it is solving the issue ?
Thanks
Comment #76
drew reece commentedThe 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.
Comment #77
held69 commentedI'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:
Comment #78
sandino commentedsubscribing
Comment #79
kevinquillen commented#60 does not work for me. Using Location CCK with Organic Groups.
What should be done?
Comment #80
held69 commentedI 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?
Comment #81
J-Chance commentedsubscribing
Comment #82
yrre7 commentedsubscribing
Comment #83
mrgoltra commentedFor those getting an error after patching. Have you tried to disable and enable the affected module?
Comment #84
johnmullin2003 commentedsubscribing ...
same issue
Comment #85
sagannotcarl commentedThe 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.
Comment #86
johnmullin2003 commentedI've still got the error in new today dev release.
Should I use the #60 patch?
any info is appreciated.
thanks!
Comment #87
merilainen commentedI 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 '4779219700615*COS(RADIANS(location_node_data_field_homelocation.latitude))*(0,91' ... in file sites/all/modules/views/includes/view.incWhen 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.
Comment #88
R.Hendel commentedsubscribe
Comment #89
kim.peppersubscribe
Comment #90
yesct commentedHas 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.
Comment #91
samhassell commentedsubscribing - manually applied the patch @ 60 and it seems to work.
Comment #92
mrgoltra commentedits back.
Comment #93
bdragon commentedFunctionally 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
Comment #94
johnmullin2003 commentedToday's New dev release has just fixed location_cck error !!!
Thanks all!
Comment #96
lugha commentedsubscribing
Comment #97
kohashi commentedjust downloaded and installed everything today... got that 348 line error. placed patch 60 and things just don't save.
Comment #98
wintervanilla commentedSubscribe -- 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.
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
Comment #99
diffstrat commentedsubscribing
Comment #100
redben commentedReopened. This still seems to be an issue. For me the warning show up when using custom breadcrumbs module
Comment #101
uomeds commentedJust got this as well.
Comment #102
uomeds commentedWow 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.
Comment #103
zach harkey commentedI'm getting the same line 385 error whenever I have the custom_pagers module enabled. When I disable the module, the error goes away.
Comment #104
Architeck commentedI 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.
Comment #105
boftx commentedsubscribe
Comment #106
boftx commentedThe 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?
Comment #107
Aniara.io commentedSubscribing
Comment #108
chosig commented#102 fixed it for me.
subscribing
Comment #109
nickl commentedThis 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.
Comment #110
AmberJoy-1 commentedsubscribe, having same problem.
Comment #111
bdragon commentedErr, wasn't the patch already applied to -dev? Why is this issue open again?
Comment #112
GeekyLass commentedError:
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
Comment #113
Aniara.io commented#102 fixed it for me too.
Comment #114
redben commentedIs this patch going to be committed any time soon ?
Comment #115
ultimike#102 worked for me as well...
-mike
Comment #116
jeffschulerAs 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?
Comment #117
redben commented@jeffschuler i am using location cck 6.x-3.1-rc1 !
I'll try the dev version as you suggest
Thanks
Comment #119
ari-meetai commented#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.).
Comment #120
summit commentedHi,
Could someone make a patch of #102 please?
greetings, Martijn
Comment #121
shaisachs commentedHere's a patch containing the fix in #102. Seems to work fine!
Comment #122
Anonymous (not verified) commentedI'm using 6.x-3.1-rc1 and I still get this error:
I incorporated the patch at #121 and that fixed it.
@bdragon: Looks like that patch is not in rc1 ...
Comment #123
m.sant commentedupdating to location-6.x-3.x-dev fixed the problem for me
Comment #124
jfox77 commentedI 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!
Comment #125
danny englanderI applied the patch from #121 in 6.x-3.1-rc1, confirmed the patch had updated the code and this fixed the issue.
Comment #126
summit commentedHi,
What is the right order to get the patch working for .dev?
greetings, Martijn
Comment #127
Anonymous (not verified) commented@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.
Comment #128
summit commentedHi,
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
Comment #129
ankur commentedRe-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.
Comment #130
myst.riven commentedJust tried the solution from Peter in #16 and the error is now gone. Thanks Peter!
Comment #131
seanrOK, 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.
Comment #132
yesct commentedre 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?
Comment #133
dreadfulcode commentedForget 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.
Comment #134
strae commentedsubscribe.
rc1 still have that error, im downloading the 3.x.dev
Comment #135
sheldon rampton commentedI experienced the issue today; applying the patch in #121 fixed the issue.
Comment #136
PeterDropCL commented#24 work cool for me
thanks