Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hi, I just updated to views 6.x-2-4 and now receive this error:
warning: Invalid argument supplied for foreach() in /drupal/sites/all/modules/views/includes/base.in
I ran the update.php file after I installed the new views module.
Is there a fix for this?
Thanks
Comment | File | Size | Author |
---|---|---|---|
#13 | 428102-broken-option-definition-causes-warning.patch | 945 bytes | merlinofchaos |
Comments
Comment #1
merlinofchaos CreditAttribution: merlinofchaos commentedI need more context, like what you're doing when this error appears, and the full error (because it usually includes a line number).
Comment #2
sskully CreditAttribution: sskully commentedIts show up on any of my main nodes/pages home, contact etc.
Here's the full error:
warning: Invalid argument supplied for foreach() in /Applications/MAMP/htdocs/VSA_site2/sites/all/modules/views/includes/base.inc on line 61.
Thanks for the quick reply.
Comment #3
Anonymous (not verified) CreditAttribution: Anonymous commentedI get the same error after upgrading to 6.x-2.4.
I noticed it when I try to use image_assist. It prevents any of the controls from being displayed in the image_assist pop-up window.
The error also shows up on all of my admin pages where warnings can be displayed.
People have been mentioning something similar here:
http://drupal.org/node/427556
Once I reverted back to Views 6.x-2.2 the error went away.
Comment #4
marcvangendI have the same error:
warning: Invalid argument supplied for foreach() in E:\Apache\htdocs\mydrupalsite\sites\all\modules\views\includes\base.inc on line 61.
I'm not using image assist, but I do use these views-relates modules: views_datascource, views_checkboxes and views_accordion.
I tried to debug by altering _set_option_defaults():
Checking if $options is set effectively removes the error message. I don't know if this its the real fix, or if there is a deeper lying problem that needs to be solved.
I added the else statement to see if I could find out anything about the context when $options is not set. It reveals that (in my situation) $storage is an empty array.
I hope this helps.
Comment #5
sskully CreditAttribution: sskully commentedI think I'm doing something wrong with your fix. I copied your code with out the
and replaced the function in the basic.inc file.
When I refresh my browser I get a blank screen.
I'm I doing something wrong?
Thanks.
Comment #6
marcvangendsskully, the dsm() function can be undefined if you don't have the devel module installed - I guess that might cause a blank page. Anyway, the code in #4 is not meant as a fix (and it is not tested as such); consider it a tool which will hopefully help to find the cause of this problem. If you want to use this as a temporary workaround to hide the error message (no guarantees, use at your own risk) then try removing the else{} part.
Comment #7
sskully CreditAttribution: sskully commentedThanks marcvangend!
I have one other question, if I revert to my previous version of views will it screw up my site?
Comment #8
merlinofchaos CreditAttribution: merlinofchaos commentedIf you have devel.module installed, can you put a vsm_trace() at that line and paste where this is happening? It might also be valuable to see if the error only happens for certain views. It may be that there are some somehow corrupted or misconfigured views that are showing this error far away from where the real problem is.
Comment #9
ghmercado CreditAttribution: ghmercado commentedSubscribing. Im getting same error message. Am using d6 and views version 6.x-2.4. It happened directly after adding a 'view feed'. I installed devel.module and got below:
* warning: preg_match() expects parameter 2 to be string, array given in /home/exchange/public_html/mywebsite/sites/all/modules/admin_menu/admin_menu.inc on line 244.
* warning: preg_match() expects parameter 2 to be string, array given in /home/exchange/public_html/mywebsite/sites/all/modules/admin_menu/admin_menu.inc on line 244.
* warning: preg_match() expects parameter 2 to be string, array given in /home/exchange/public_html/mywebsite/sites/all/modules/admin_menu/admin_menu.inc on line 244.
* warning: preg_match() expects parameter 2 to be string, array given in /home/exchange/public_html/mywebsite/sites/all/modules/admin_menu/admin_menu.inc on line 244.
* warning: preg_match() expects parameter 2 to be string, array given in /home/exchange/public_html/mywebsite/sites/all/modules/admin_menu/admin_menu.inc on line 244.
* warning: preg_match() expects parameter 2 to be string, array given in /home/exchange/public_html/mywebsite/sites/all/modules/admin_menu/admin_menu.inc on line 244.
* warning: preg_match() expects parameter 2 to be string, array given in /home/exchange/public_html/mywebsite/sites/all/modules/admin_menu/admin_menu.inc on line 244.
* warning: preg_match() expects parameter 2 to be string, array given in /home/exchange/public_html/mywebsite/sites/all/modules/admin_menu/admin_menu.inc on line 244.
* warning: preg_match() expects parameter 2 to be string, array given in /home/exchange/public_html/mywebsite/sites/all/modules/admin_menu/admin_menu.inc on line 244.
* warning: preg_match() expects parameter 2 to be string, array given in /home/exchange/public_html/mywebsite/sites/all/modules/admin_menu/admin_menu.inc on line 244.
* warning: Invalid argument supplied for foreach() in /home/exchange/public_html/mywebsite/sites/all/modules/views/includes/base.inc on line 61.
am not sure how to do a vsm_trace() sorry
Comment #10
marcvangend@merlinofchaos #8: I'll get back on that on tuesday, when I'm back at work.
Comment #11
deviantintegral CreditAttribution: deviantintegral commentedHere is a vsm_trace() for you. It appears to be affecting all of my views. This one is generated by previewing a View in the edit tab, so it should only be from that single view. It appears that $options is being set to an empty array occasionally. Sorry for the length :(
Comment #12
merlinofchaos CreditAttribution: merlinofchaos commenteddeviantintegral: Thanks. That's unfortunately just making me go 'buh' even more. It *looks* like somewhere, some handler has an improperly created 'option_definition()' method. Let's try this:
Just before line 61 where it crashes:
Let's see if that shows us anything interesting.
Comment #13
merlinofchaos CreditAttribution: merlinofchaos commentedThanks to deviantintegral we have figured this out. The fix is committed but here is the patch for those not operating out of CVS.
Comment #14
marcvangendNice work, thanks for the fix.
Comment #15
yched CreditAttribution: yched commenteder, oops :-(
Comment #16
merlinofchaos CreditAttribution: merlinofchaos commentedyched: No worries, these things happen. =)
Comment #17
Anonymous (not verified) CreditAttribution: Anonymous commentedI'm getting the same set of warnings on admin pages regarding admin_menu.inc line 244 (as noted in post #9). I do not get the warning about base.inc.
This is directly after upgrading from 2.3->2.5, and after running the DB update script.
Comment #18
Anonymous (not verified) CreditAttribution: Anonymous commentedComment #19
merlinofchaos CreditAttribution: merlinofchaos commentedadmin_menu.inc is not a Views file so I don't believe that's related to Views.
Comment #20
Anonymous (not verified) CreditAttribution: Anonymous commentedPerhaps. The error popped up right after my update to 2.5. Backing down to 2.3 resolves the issue.
Comment #21
highermath CreditAttribution: highermath commentedYou aren't by any chance, running devel? This issue has popped up there and is resolved by going to the dev version. http://drupal.org/node/430374
Comment #22
Anonymous (not verified) CreditAttribution: Anonymous commentedI am in fact. I disabled it, however these errors seem very random in nature so it made testing difficult. I wonder why the Views update kicked off the warnings caused by devel? Either way thanks!
Comment #23
Anonymous (not verified) CreditAttribution: Anonymous commentedIt also pops up if you use the image assist module, after upgrading Views. See bug http://drupal.org/node/42755
EDIT: sorry, this was already mentioned earlier...
Comment #24
ghmercado CreditAttribution: ghmercado commentedYup, figured that out. Thanks a lot for the fix.
Comment #26
jrabeemer CreditAttribution: jrabeemer commented#22, I was getting a foreach() error at
views/includes/base.inc on line 173.
Disabling the Devel module fixed it.
Comment #27
alexx90 CreditAttribution: alexx90 commentedI have the same problem I tried every thing but that not help
warning: Invalid argument supplied for foreach() in /home/pa2230rd/public_html/grps/sites/all/modules/views/includes/base.inc on line 60.
the file is