Site icon Hip-Hop Website Design and Development

PHP Deadly Error in cache.php on line 123 $wp_object_cache is non-object

I exploit the transient this fashion (easy Instance):

operate my_url_cache( $url ) 
{
   $transient_id = hash( "crc32", $url );
   $content material = get_transient( 'my_url_cache_' . $transient_id );
   set_transient( 'my_url_cache_' . $transient_id, $content material, 60 * 60 * 24 );
   set_transient( 'my_url_cache_backup_' . $transient_id, $content material, 0 ); 
}

Along with a plugin from my firm they get this error, once they need to refresh their cache:

Name to a member operate get() on a non-object in
/wordpress/wp-includes/cache.php on line 123

With out my plugin they haven’t any issues

/wordpress/wp-includes/cache.php on line 123:

/**
 * Retrieves the cache contents from the cache by key and group.
 *
 * @since 2.0.0
 *
 * @see WP_Object_Cache::get()
 * @international WP_Object_Cache $wp_object_cache Object cache international occasion.
 *
 * @param int|string  $key    The important thing underneath which the cache contents are saved.
 * @param string      $group  Optionally available. The place the cache contents are grouped. Default empty.
 * @param bool        $drive  Optionally available. Whether or not to drive an replace of the native cache from the persistent
 *                            cache. Default false.
 * @param bool        $discovered  Optionally available. Whether or not the important thing was discovered within the cache. Disambiguates a return of false,
 *                            a storable worth. Handed by reference. Default null.
 * @return bool|combined False on failure to retrieve contents or the cache
 *                    contents on success
 */
    operate wp_cache_get( $key, $group = '', $drive = false, &$discovered = null ) {
        international $wp_object_cache;

        return $wp_object_cache->get( $key, $group, $drive, $discovered ); // Line 123
    }

On my Testserver I can not reproduce this error.

They do not use a distinct Caching system.

The $wp_object_cache appears to not be an object. I do not know if for my plugin or their plugin or each.

Do I’ve to make use of a particular hook in WordPress, earlier than I can use the get_ and set_transient capabilities? I exploit my cache operate inside this hook solely:

add_shortcode( 'feedimport', array( $this, "shortcode_feedimport" ) );

UPDATE:

The opposite plugin makes use of the wp_schedule_event:

personal static operate cron_schedule_event_setup() {
    wp_clear_scheduled_hook(self::cron_hook);
    wp_schedule_event(time(), self::$choices['schedule_event'], self::cron_hook);
}

And retailer their knowledge in a database desk. They do not use the get_ set_transient capabilities. 🙁

I realy do not understand how my plugin can have an effect on their plugin. Full Code of their plugin: hyperlink

Replace 2 – Solved:

public operate __destruct() {
    $this->save_log();
}

This code begins a operate which makes use of the wordpress caching system.

Altering to this:

add_action('shutdown', array($this, "save_log"));

Solved the Drawback. I by no means use WordPress Features once more in a Destructor.