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.
I just upgraded to PHP5.3 and am getting the following:
warning: Invalid argument supplied for foreach() in .../sites/all/modules/wysiwyg_filter/wysiwyg_filter.inc on line 523.
The line number changes depending upon the node I'm on, sometimes I also get:
warning: Invalid argument supplied for foreach() in .../sites/all/modules/wysiwyg_filter/wysiwyg_filter.pages.inc on line 425.
Anybody know if this is easy to fix? I looked through the code, and it looks like it's not getting a variable correctly from the database. I can see if I can dig up more details...
Comment | File | Size | Author |
---|---|---|---|
#6 | variable.txt | 16.45 KB | pal_ur |
Comments
Comment #1
Renee S CreditAttribution: Renee S commentedWell, nevermind. I ran cron, it disappeared. The best kind of error - the kind that is easily fixed =)
Comment #2
Renee S CreditAttribution: Renee S commentedAh, spoke too soon. It's still present on node edit pages.
Comment #3
markus_petrux CreditAttribution: markus_petrux commentedRe: "warning: Invalid argument supplied for foreach() in .../sites/all/modules/wysiwyg_filter/wysiwyg_filter.inc on line 523"
hmm... this line looks like this:
Note that variable_get() should return an array when 1) the variable exists, or 2) the variable does not exit (defaults to empty array).
So that PHP warning suggests that the variable exists, but it is NOT an array? Well, that's a different issue that could not be related to PHP 5.3. However, if we look at wysiwyg_filter_settings_filter_submit(), the code that parses the filter settings ensures these variables are stored as arrays. So, it seems that these variables have been corrupted somehow in your database.
Try saving the configuration of your input format and see if that helps. If that does not help, then we need to know what your variables contain, and then try to guess how they were corrupted.
Comment #4
markus_petrux CreditAttribution: markus_petrux commentedComment #5
Renee S CreditAttribution: Renee S commentedOK, thanks. I rearranged the filters and added some checkboxes to the "allowed" items, and re-saved... and it came back once with the same error; tried it a second time changing a few more things, and it saved fine the second time, no more error anywhere.
Very strange! I hadn't touched it since I set it up a month ago; maybe something in the switch affected it. Who knows. It works now. Sorry. And thanks =)
Comment #6
pal_ur CreditAttribution: pal_ur commentedSame problem, the relevant rows exported as CSV and attached as TXT.
Comment #7
alexbk66- CreditAttribution: alexbk66- commentedSame problem, I run cron and get many
Any help?
Comment #8
Renee S CreditAttribution: Renee S commentedIt seems like the wysiwyg entries get corrupted or moved around in a way the filter doesn't understand. Have you tried rearranging the filters or adding/removing things from them? That seemed to fix it for me.
Comment #9
alexbk66- CreditAttribution: alexbk66- commentedSure I tried everything.
There ere related issues:
#885632: Don't export variables with a default value
#887532: Follow up: Input formats integration
Don't seem to be resolved, even if one of them is closed...
And when I set "Rules for URLs used within inline styles: /*" it doesn't get saved, I keep getting the warning:
Comment #10
BarisW CreditAttribution: BarisW commentedI'm having the same issue. It seems that all my values are empty strings:
Comment #11
BarisW CreditAttribution: BarisW commentedSetting this back to active because the problem still stands with the latest release 6.x-1.5.
For those who want to use to use it without errors.. (dirty) just add a @ in front of the foreach:
@foreach (variable_get('wysiwyg_filter_'. $rule_key .'_'. $format, array()) as $rule) {
Comment #12
BarisW CreditAttribution: BarisW commentedThis might be a better/cleaner solution:
Comment #13
freestone CreditAttribution: freestone commentedSame issue but in my 6.x-1.5
Puting an @ in front of that foreach sure does not work....diff error.
Putting the new code into wysiwyg_filter.inc on line 523. does nothing.
I have tried rearranging the filters, adding valid tags etc. Nothing seems to remmidy this issue for me.
I have read on an off about this for months. No solid solution ?
Any help would be appriciated.
Comment #14
freestone CreditAttribution: freestone commentedUsed phpadmin to empty all cache tables, changed the filter options, ran cron, ran update. After doing all those the problem went away. Not sure what fixed it but next time I clone the site I will try them one at a time. I am thinking it is a cache issue. At least for me when I clone a site to a new domain.
Comment #15
geek-merlinClosing 6.x issues.