Quantcast
Channel: Topic Tag: error | WordPress.org
Viewing all articles
Browse latest Browse all 31591

med_freeman on "[Plugin: Yet Another Related Posts Plugin] YARPP Fatal Error in ajax context"

$
0
0

yarpp: v4.0.6

Hi,

first, thanks for your great work !

i'm loading the body of specific pages via ajax instead of regular full page request, and that worked perfectly until i enabled yarpp.

yarpp works in standard context, but i now have a php fatal error in my xhr response (ajax) :

Fatal error: Class name must be a valid object or a string in /home/www/260a3a65240797a4ffcfe1fda27207fd/web/test/wordpress/wp-content/plugins/yet-another-related-posts-plugin/class-core.php on line 29

To diagnose, i added this code before the offending line (l.29) :

// load cache object
 require_once(YARPP_DIR . '/class-cache.php');
 require_once(YARPP_DIR . '/cache-' . YARPP_CACHE_TYPE . '.php');
 $this->storage_class = $yarpp_storage_class;

 //ADDED TEST CODE
 echo $this->storage_class;
 if($this->storage_class == '') {
    echo 'Cache class reference is now empty';
 }

l.29
 $this->cache = new $this->storage_class( $this );

In standard context i only have an echo of 'YARPP_Cache_Tables' in my pages.

In ajax context i have again 'YARPP_Cache_Tables', but then 'Cache class reference is now empty'.

So it seems $this->storage_class loses its value the second after it is initialized with the correct value 'YARPP_Cache_Tables'.

I can't seem to find why...

Just to be a little more precise, ajax context in wordpress goes via admin, so a call to is_admin() in an ajax request would return true.

Best

http://wordpress.org/plugins/yet-another-related-posts-plugin/


Viewing all articles
Browse latest Browse all 31591

Trending Articles