• Whenever I publish a new ad, I get different warning messages:

    Warning: Invalid argument supplied for foreach() in /app/public/wp-content/plugins/apply-online/admin/class-applyonline-admin.php on line 863
    Warning: array_diff(): Argument #1 is not an array in /app/public/wp-content/plugins/apply-online/admin/class-applyonline-admin.php on line 862
    Warning: Cannot modify header information – headers already sent by (output started at /app/public/wp-content/plugins/apply-online/admin/class-applyonline-admin.php:862)

    The ad IS saved and published, though. Yesterday, before the latest update, this only happened when Publishing a new ad, now with the latest update I also get warnings when updating an existing ad.
    There’s no problem on the front-end, the ads display fine, the problem described above only happens on the back-end.

    I tried both PHP 7.2.0 and 7.0.3, but the result is the same.

Viewing 6 replies - 1 through 6 (of 6 total)
  • Thread Starter frizzel

    (@frizzel)

    Update:
    The warning when updating an existing ad only happens when I change something in the text area or in the excerpt, not when changing e.g. features.

    • This reply was modified 6 years, 10 months ago by frizzel.
    Plugin Author Farhan Noor

    (@farhannoor)

    Hi Frizzel,

    I tried this scenario in different environments but could not regenerate this error at my end. It seems to be a conflict with another plugin or current theme. Try these debugging techniques to identify the cause.

    1. Try deactivating all plugins except ApplyOnline & check if you still have such warnings. Reactivating all plugins one by one will help you to identify the concern plugin.
    2. If above don’t work then try switching your theme to a default WordPress theme & check if you still have warnings or not

    Hope above solution will work for you.

    Best Regards.

    Thread Starter frizzel

    (@frizzel)

    I’m working on a local install. Just tried it on a fresh WP install with default theme (TwentySeventeen) and only this plug-in.
    Changed web server from nginx to Apache.
    Changed PHP version back to 5.6.20
    All gave the same result as I described above.

    If I comment lines 862-865 in ‘class-applyonline-admin.php’, the warnings are gone.
    But that’s probably not the way it should be.
    Anyhow, it seems to point to some code error right there.

    • This reply was modified 6 years, 10 months ago by frizzel.
    Thread Starter frizzel

    (@frizzel)

    Hm, if I change line 859 from
    $old_keys = get_post_custom_keys($post_id);
    to
    $old_keys = get_post_custom_keys($post->ID);
    the warnings are also gone.
    Could that be it?

    Plugin Author Farhan Noor

    (@farhannoor)

    $post variable does not make any sense as it does not exist in the method. So, it will always have NULL value. Commenting line 862-865 or using $post variable has same impact.

    You should contact on plugin’s website so we may arrange a test case on live site where both of us could test things.

    Best Regards.

    Thread Starter frizzel

    (@frizzel)

    Thanks for the clarification.

    As said, it’s not on a live site, yet, only a local install.
    Maybe I’ll contact you again when it’s live.
    But, just out of curiosity, what exactly do these
    $old_keys
    and
    $new_keys
    store and delete?

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘PHP Warnings back-end’ is closed to new replies.