• Resolved tezalsec

    (@tezalsec)


    Hey Daan, I don’t want to be negative, I very much appreciate your work and would still give you 5 stars, but this is the 3rd time in 2 years I have had a fatal error during an update of your plugin. I’ll wait a week from now on to update, to see what others experience…

    Fatal Error:
    Een fout van het type E_ERROR werd veroorzaakt op regelnummer 175 van het bestand /var/www/vhosts/xxx/httpdocs/wp-content/plugins/host-analyticsjs-local/includes/class-cron.php. Foutmelding: Uncaught Error: Call to undefined method CAOS::get() in /var/www/vhosts/xxx/httpdocs/wp-content/plugins/host-analyticsjs-local/includes/class-cron.php:175
    Stack trace:
    #0 /var/www/vhosts/xxx/httpdocs/wp-content/plugins/host-analyticsjs-local/includes/class-cron.php(38): CAOS_Cron->build_download_queue()
    #1 /var/www/vhosts/xxx/httpdocs/wp-content/plugins/host-analyticsjs-local/includes/class-caos.php(293): CAOS_Cron->__construct()
    #2 /var/www/vhosts/xxx/httpdocs/wp-content/plugins/host-analyticsjs-local/includes/class-caos.php(349): CAOS->trigger_cron_script()
    #3 /var/www/vhosts/xxx/httpdocs/wp-includes/class-wp-hook.php(308): CAOS->do_update_after_update()
    #4 /var/www/vhosts/xxx/httpdocs/wp-includes/class-wp-hook.php(332): WP_Hook->apply_filters()
    #5 /var/www/vhosts/xxx/httpdocs/wp-includes/plugin.php(517): WP_Hook->do_action()
    #6 /var/www/vhosts/xxx/httpdocs/wp-admin/includes/class-plugin-upgrader.php(371): do_action()
    #7 /var/www/vhosts/xxx/httpdocs/wp-admin/update.php(51): Plugin_Upgrader->bulk_upgrade()
    #8 {main}
    thrown

    Regards,
    Tez

Viewing 15 replies - 1 through 15 (of 15 total)
  • Plugin Author Daan from Daan.dev

    (@daanvandenbergh)

    I know, it sucks! And I still don’t get exactly why this happens and how I can preven it.

    Every time I introduce a new function in the main file (includes/class-caos.php) for some reason, during updating, this file comes last, but it’s already executing the rest of the code — or something. Also, it seems to only happen on servers running some sort of PHP caching mechanism, like Opcache or Varnish.

    Are you running either of those? If so, flushing those caches should resolve the issue.

    So, flushing those caches before the update should prevent the issue. Unfortunately I’ve no clue what I can do about that.

    Plugin Author Daan from Daan.dev

    (@daanvandenbergh)

    Wait, I just noticed something in your stack trace: I run an update of the JS files after the update of the plugin is done, this function is called update_after_update. Maybe the timing there isn’t correct and the new code is executed too soon? I’ll look into this, thanks for sharing!

    Thread Starter tezalsec

    (@tezalsec)

    Isn’t everybody using opcache these days?

    Glad to be of help, hope you figure it out.

    By the way, I said “I would still give you 5 stars”, but just noticed I already did in the past.

    Highly appreciate your attitude towards users. 🙂

    additional heads up:
    with the update (and reactivation) my GA tracking ID was not there anymore. I had dual tracking enabled (GA3 + GA4) and the GA4 ID showed up when I entered the normal one. no tracking for that hour or so, not sure if there’s a bug or not.

    Plugin Author Daan from Daan.dev

    (@daanvandenbergh)

    Yes, this update includes a more efficient way to fetch options from the database. That’s the function it can’t find (CAOS::get()). So, that’s why the options aren’t shown.

    Flushing your PHP cache (and no, not everyone is using it @tezalsec, haha, I’m not 😉) should bring back your settings, @_jo

    Got a warning right after the plugin update yesterday that it failed. But the internal notification of “this plugin has a new update available” disappeared, so I think it still got updated.

    But the field in “Google Analytics Tracking ID” in basic settings is blank. I assume it was not before?

    Also got an email notification:

    WordPress has a built-in feature that detects when a plugin or theme causes a fatal error on your site, and notifies you with this automated email.

    In this case, WordPress caught an error with one of your plugins, CAOS.

    The same e-mail also asked me to check:

    My URL/wp-admin/admin-ajax.php

    And that page shows a blank page with a “0” in the upper left corner.

    Edit: I added back my UA- tracking ID and it automatically remembered and filled out the G- tracking ID too. I regenerated the alias and it seems to all be ok now.

    Plugin Author Daan from Daan.dev

    (@daanvandenbergh)

    Hey, thanks for sharing your findings @androgenicalopecia,

    could you share the error in the email you received?

    Besides what I posted in my last comment regarding the email content, the subject of the email was “Your Site is Experiencing a Technical Issue” and another part of the e-mail said “If your site appears broken and you can’t access your dashboard normally, WordPress now has a special “recovery mode”. This lets you safely login to your dashboard and investigate further.”

    No particular precise error name or description mentioned besides the “ajax” page link I posted before. Email said that I would find the error that was caught on that linked page (where I found and still find just a “0” on top).

    In any event, the problem is now gone and thanks for the plugin!

    Plugin Author Daan from Daan.dev

    (@daanvandenbergh)

    Makes sense that the “ajax” link just shows 0. Nothing happens in that file without any input.

    But it does mean that the error occurred during an Ajax request. So, I’m going to dig through my code, to see if I execute any Ajax after or during the update (and if not, the Update-process is an Ajax proces in itself, so then I’ll have that to go on.)

    To be continued!

    Plugin Author Daan from Daan.dev

    (@daanvandenbergh)

    I think I found what was causing it. It was indeed the do_update_after_update function.

    I’m releasing 4.6.1 in a minute. If anyone of you is willing to give it a shot to see if the error is gone, that’d be much appreciated.

    It updated fine this time and kept both UA- and G- Analytics tracking IDs in their respective boxes. Google Analytics live tracking data also seems ok and did not go to 0.

    Plugin Author Daan from Daan.dev

    (@daanvandenbergh)

    @androgenicalopecia Did you update from 4.5.0 or from 4.6.0?

    Thread Starter tezalsec

    (@tezalsec)

    Sorry to say, I applied your update 4.6.1 on another website, skipping 4.6.0, but I got the same error as above…

    Plugin Author Daan from Daan.dev

    (@daanvandenbergh)

    Are you sure it’s exactly the same error? Because I literally removed the code that was executed in the previous error. So, if it’s still executed, then it must be PHP caching (Opcache, Cloudflare APO, etc.)

    Please share the stack trace if you have one.

    Plugin Author Daan from Daan.dev

    (@daanvandenbergh)

    I’ve been able to reproduce the error during update, and I can confirm that it was related to the do_update_after_update function.

    The only thing I can’t quite understand is that there apparently is a moment where the new code executes in class-cron.php, but runs into the old code in class-caos.php.

    Maybe the upgrader_process_complete action is triggered too soon, or PHP caches (like Opcache, Varnish or Cloudflare APO) are in the middle of flushing after the update at that point?

    To be honest, I don’t know. What I do know, is that after 4.6.1 this error won’t come back and the update process does actually succeed, although WordPress says it doesn’t.

    Also, it won’t crash your site, because it only occurs during the update process of CAOS to 4.6.1. After that, it won’t happen again because do_update_after_update is removed.

    Thanks for your help in debugging this, guys!

Viewing 15 replies - 1 through 15 (of 15 total)
  • The topic ‘last update contains fatal error, undefined method CAOS::get()’ is closed to new replies.