• When I started Wp super cache for a few hours, I get lots of error message in apache log which shows:

    PHP Fatal error: Call to a member function get() on a non-object in D:\\web\\mwobetawp\\wp-includes\\cache.php on line 93

    If I disable Wp super cache or in the first a few hours after it starts, this error never occurs.
    Anyone can help me on this? Thanks.

Viewing 8 replies - 16 through 23 (of 23 total)
  • Strange. wpdb and the cache destructors are called twice during shutdown.

    [03-Feb-2009 09:32:45] 3906 wpdb shutdown!
    [03-Feb-2009 09:32:45] 3906 cache shutdown!
    [03-Feb-2009 09:32:45] 3906 wpsupercache shutdown!
    [03-Feb-2009 09:32:45] 3906 cache shutdown!
    [03-Feb-2009 09:32:45] 3906 wpdb shutdown!

    And when I added a destructor to the cachemeta class this is what happened. It’s a wonder the meta file generation happens at all correctly any more. I need to figure out if I can change the order of shutdown somehow.

    [03-Feb-2009 10:20:21] 3974 wpdb shutdown!
    [03-Feb-2009 10:20:21] 3974 cache shutdown!
    [03-Feb-2009 10:20:21] 3974 cachemeta shutdown!
    [03-Feb-2009 10:20:21] 3974 wpsupercache shutdown!
    [03-Feb-2009 10:20:21] 3974 cachemeta shutdown!
    [03-Feb-2009 10:20:21] 3974 cache shutdown!
    [03-Feb-2009 10:20:21] 3974 wpdb shutdown!

    From reading https://ie2.php.net/register-shutdown-function I think I see the above because the server is running PHP5.
    Registered shutdown functions execute before deconstructors in an object. The first shutdowns before wpsupercache are those, the ones after are the deconstructors.

    Yes. That’s it. I commented out the register_shutdown_function() calls and here’s what was logged:
    [03-Feb-2009 10:29:58] 4165 wpsupercache shutdown!
    [03-Feb-2009 10:29:58] 4165 cachemeta shutdown!
    [03-Feb-2009 10:29:58] 4165 cache shutdown!
    [03-Feb-2009 10:29:58] 4165 wpdb shutdown!

    Which would work perfectly well.

    I think the first wpdb and cache shutdown is via the shutdown callback which fires in PHP4 and PHP5, and the second is the direct call to __destruct(). The second will only appear with PHP5.

    I’m assuming that the references (e.g. global $wpdb) to them are invalid after the first event.

    It’s pretty confusing though.

    I’ve rearranged the code a bit. The ob callback is removed, and instead a shutdown function is registered in wp-cache-phase1.php right at the start of the process and long before wpdb and cache.php are loaded. It seems to work and objects are destroyed in the right order.

    Grab wp-cache-phase* from svn or below:

    https://svn.wp-plugins.org/wp-super-cache/trunk

    Thank you donncha! I was having a TON of php errors in my logs. After grabbing the files all is now good. ?? I hope the author see’s this thread and updates the plugin for everyone else.

    Um… mprindle, just FYI: donncha is the plugin author. ??

    Speaking of which: it looks like you’ve licked the issue for me, as well (PHP 5.2.6 here) and, FYI, in my case it was typically prompted by visitors coming in from a Google (or Google Images) image search. So far, after using your two suggested files, I’m not seeing those pesky error messages anymore of
    PHP Fatal error: Call to a member function get() on a non-object in [path-to] cache.php on line 93, referer: https://www.google.com/
    (also happened with other localized Google portals, also Google Images)

    I want to sue the guy responsible for Murphy’s Law. Right after I posted that, bam: another of those weird errors. But, at least it’s very sporadic which still is progress.

Viewing 8 replies - 16 through 23 (of 23 total)
  • The topic ‘[Plugin: WP Super Cache] Call to a member function get() on a non-object in cache.php’ is closed to new replies.