Skip to content

Commit e8bbacd

Browse files
committed
Fixed bug with serialized data
1 parent 6908fb3 commit e8bbacd

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

app/Cache.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,17 @@ public static function get_object( $key = null, $callback ) {
1818
$object_cache_expire = self::$settings['object_cache_expire'] ?: 86400; // Default to 24 hours of null
1919

2020
// Set key variable
21-
$object_cache_key = self::$prefix . '_' . $key . ( is_multisite() ? '_' . get_current_blog_id() : '' );
21+
$object_cache_key = $key . ( is_multisite() ? '_' . get_current_blog_id() : '' );
2222

2323
// Try to get the value of the cache
2424
$result = wp_cache_get( $object_cache_key, $object_cache_group );
25-
if( is_serialized($result) ) $result = unserialize($result);
25+
if( $result && is_serialized( $result ) ) $result = unserialize($result);
2626

2727
// If result wasn't found/returned and/or caching is disabled, set & return the value from $callback
28-
if(!$result) {
28+
if(true || !$result) {
2929
$result = $callback();
30-
if( is_array( $result ) || is_object( $result ) ) $result = serialize( $result );
31-
wp_cache_set( $object_cache_key, $result, $object_cache_group, $object_cache_expire);
30+
if( is_array( $result ) || is_object( $result ) ) $set_result = serialize( $result );
31+
wp_cache_set( $object_cache_key, $set_result, $object_cache_group, $object_cache_expire);
3232
}
3333

3434
return $result;
@@ -58,7 +58,7 @@ public static function flush($ID = null, $post = null) {
5858

5959
if( defined('DOING_AJAX') && DOING_AJAX ) {
6060
echo json_encode($result);
61-
wp_die();
61+
die();
6262
}
6363
return $result['success'];
6464

0 commit comments

Comments
 (0)