Support » Plugin: WP Custom Widget area » Upgraded to 1.2.5 and foreach() error showing

  • I just upgraded to 1.2.5 and I am now weeing an error appear at the top of my pages:

    <b>Warning</b>: Invalid argument supplied for foreach() in <b>/home/content/a2pnexwpnas04_data01/42/3553042/html/wp-content/plugins/wp-custom-widget-area/admin/class-wp-custom-widget-area-admin.php</b> on line <b>302</b><br />
    <br />
    <b>Warning</b>: Invalid argument supplied for foreach() in <b>/home/content/a2pnexwpnas04_data01/42/3553042/html/wp-content/plugins/wp-custom-widget-area/admin/class-wp-custom-widget-area-admin.php</b> on line <b>332</b><br />

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Author krozero

    (@krozero199)

    Hi @ohiolug, it’s looks like the custom wrapper JSON object you entered is not a valid JSON objet array type. please make sure it is enclosed with [ ].
    i.e:
    [{“tag”: “span”, “id”: “mywidget”}] //if single element

    [{“tag”: “span”, “id”: “mywidget”}, {“tag”: “span”, “id”: “inner”}] //if multiple wrapper element

    currently, JSON object array validation is not very strong, so it’ll let you submit any JSON object in with or without [ ] brackets. but the plugin uses JSON object type [ { .. }, {..}]. i’m working on few updates. will release next version soon with fix for this validation issue.

    please follow above example type. i think that should fix that error.

    Thanks,
    Kishor

    Thread Starter ohiolug

    (@ohiolug)

    Sorry Kishor, I’m not a developer. So I’m not certain where to make this fix Can I just roll back to the previous version where this error did not occur?

    Plugin Author krozero

    (@krozero199)

    can you try deactivate and reactivate plugin? see if that fix the problem? if it didn’t you can download old version form https://wordpress.org/plugins/wp-custom-widget-area/developers/
    1.2.2 is previous version. download and extract it to plugins directory (replace or delete recently updated version). i’ll look into this issue. thanks!

    I have this exact same issue. I have tried deactivating and reactivating and I still have the error. I also do not understand where to update that code. Can you please provide more feedback?

    This is my error:

    Invalid argument supplied for foreach() in … /wp-content/plugins/wp-custom-widget-area/admin/class-wp-custom-widget-area-admin.php on line 332

    Thank you in advance.

    • This reply was modified 4 years, 4 months ago by itcassy.

    Same problem here. Isn’t just the case of set $cwa_widget_wrappers as an empty array when json decode return an empty string? I didn’t make a deep review of the code but in my case I saw that $cwa_widget_wrappers is an empty string trying to be iterated in a foreach.

    An error is now showing with v1.2.2 also

    Invalid argument supplied for foreach() in /home/…/admin/class-wp-custom-widget-area-admin.php on line 332 (same as @schacher – even the line number)

    I get the notice on the front end and backend. The issue began with the last update (1.2.5). I rolled back the update to 1.2.2 after the last time I posted and it fixed it but not anymore.

    I just tried rolling back to 1.2.1 and it is ok for now. Can you please let us know if you are planning on looking into this issue?

    • This reply was modified 4 years, 3 months ago by itcassy.

    Can we please get some support on this? I rolled back to 1.2.2 and it fixed it for a couple days. Rolled back to 1.2.1 and it also fixed it for a couple days. I do not understand what is happening but obviously there are issues since the new WP release. Please help.

    I had the same problem today, found a solution to fill blank values in the database.

    Under xxxxxxxx.wp_gdbpvc_cwa table; look for empty values under cwa_widget_header_wrapper column, fill them with h2 or whatever suitable for your case, then try to check again, make sure you purge cache, varnish if you use any plug-in.

    I think it is also possible to fix this issue in the backend with editing all Custom Widget Areas one-by-one selecting a proper header wrapper.

    Hello,

    We are getting the same errors as everyone else across our sites. Please update plugin…

    Had to rollback.

    — Netivity

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Upgraded to 1.2.5 and foreach() error showing’ is closed to new replies.