• Resolved Saksham

    (@sakshamt)


    Crons are failing. Upon debugging I could find this error:

    Fatal error: Uncaught Error: [] operator not supported for strings in ..public_html/wp-content/plugins/newsletter/plugin.php:279

    This leads to next_run_relative of the newsletter cron job to be always now. And all crons that are supposed to run next after the newsletter break.

    Is there a way we can fix it?

    • This topic was modified 3 years, 6 months ago by Saksham.
Viewing 6 replies - 1 through 6 (of 6 total)
  • Thread Starter Saksham

    (@sakshamt)

    I searched about it with reference to other plugins/PHP in general. Many people have suggested to declare $calls as an array first before using it. Something like the below I suppose:

    $calls = array();
    $calls = get_option(‘newsletter_diagnostic_cron_calls’, array());
    $calls = time();

    I tried and it worked. Crons are going ahead at least. Not sure if it breaks any internal plugin functionality though.

    Would be great if you can check.

    Plugin Author Stefano Lissa

    (@satollo)

    Thank you for reporting, I’ll check the plugin code. If the option I missing the default empty array value should be returned.

    Stefano.

    Plugin Author Stefano Lissa

    (@satollo)

    Hi, the code in Newsletter is ok, for some reason the get_option() is returning a string. Have you a database caching plugin?

    Thread Starter Saksham

    (@sakshamt)

    Hi Stefano,

    Thanks for replying back. I think my web host utilizes Varnish. Can that cause a problem?

    Plugin Author Stefano Lissa

    (@satollo)

    No, is not something connected to varnish, that is a page cache, not a database cache. Anyway I added some protection code to avoid those weird errors.

    Stefano.

    Thread Starter Saksham

    (@sakshamt)

    Thanks a lot Stefano! I can see the fix in today’s update.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Fatal Error in Plugin Resulting in Cron Job Not Working’ is closed to new replies.