Invalid argument supplied for foreach()
rzelnik - November 10, 2009 - 05:46
| Project: | Custom filter |
| Version: | 6.x-2.x-dev |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | fixed |
Description
When I try to change the order of rules in a custom filter, I receive this error message:
warning: Invalid argument supplied for foreach() in /path_to_my_site/sites/all/modules/customfilter/customfilter.admin.inc on line 378.
...and the changed order is not saved.
I use Drupal 6.14 on PHP 5.2.6-3ubuntu4.2.

#1
I cannot reproduce this. I am testing it on the last development snapshot of Drupal 6 (which shows also the notice messages), but I don't get any error when I change the order of the rules. It is true that I am using PHP 5.3.0, but I don't think it changed something about that.
#2
Also, are you sure you reported the correct version? In version 6.x-2.0-beta7, the FOREACH-statement is at line 384.
#3
I was able to reproduce the error, and I have changed the code.
Thanks for your report.
#4
That's great! Thanks for quick response. :)
#5
I will create a new official release once that I resolved #628532: Allow multiple descriptions - one for each language enabled on Drupal.
If you are not comfortable to use a development snapshot, I can tell you how you need to change the code.
#6
Automatically closed -- issue fixed for 2 weeks with no activity.
#7
Could you please publish the change in the code? I have tried a development snapshot, but the database update was unsuccessfull - there are some typos:
An error occurred. http://..my site path.../update.php?id=8&op=do
Fatal error: Call to undefined function db_query_raange() in /...my site path.../sites/all/modules/customfilter/customfilter.install on line 279
I have fixed db_query_raange() to db_query_range(), but then some new failures appeared:
Failed: ALTER TABLE {customfilter_filters} DROP shorttip
- it's {customfilter_filter}
Failed: ALTER TABLE {customfilter_rules} ADD INDEX customfilter_rule_prid (prid)
- it's {customfilter_rule}
#8
In the _customfilter_rules_tree_form function in customfilter.admin.inc, delete the "$form = array();" line (it is line 847 in 6.x-2.0-beta7)
#9
Yes, it works now, thanks!
#10
I am marking this report as fixed; the last comments report a different issue, which should have its own report.