Support » Plugin: W3 Total Cache » Bug in APC object cache wp_cache_set() making it fail

  • In your drop in located at: wp-content/object-cache.php

    you have:

    ` function wp_cache_set($id, $data, $group = ‘default’, $expire = 0) {
    global $wp_object_cache;

    return $wp_object_cache->set($id, $data, $group, $expire);
    }`

    This appears correct order of args ( KEY, DATA, GROUP, EXPIRY )

    But then look into your APC implementation of set() in file: w3-total-cache/lib/W3/Cache/Apc.php

    you have:

    ` function set($key, $var, $expire = 0, $group = ‘0’) {
    $key = $this->get_item_key($key);

    $var[‘key_version’] = $this->_get_key_version($group);

    return apc_store($key . ‘_’ . $this->_blog_id, serialize($var), $expire);
    }`

    Notice you have got EXPIRY and GROUP the oposite way round. So group is getting set as expiry and visa-versa.

    This breaks APC opcode functionality in the plugin and by switching them the correct way round opcode caching functions correctly…

    http://wordpress.org/plugins/w3-total-cache/

Viewing 6 replies - 1 through 6 (of 6 total)
  • At the end there I say opcode caching but meant to say object caching. Sorry for any confusion.

    (i use 2 apc on my vps)
    i my case i deactivate on my 3.6 multisite the plugin and still active(!!) and it doesn’t show me the the link to delete the plugin via the admin

    also, i got this error on my error_log

    [15-Aug-2013 15:23:30 UTC]
    Error Table ‘xxxx_dbsp.wp_users’ doesn’t exist database WordPress for request SELECT COUNT(*) FROM wp_users INNER JOIN wp_usermeta ON (wp_users.ID = wp_usermeta.user_id) WHERE 1 = 1 AND ( wp_usermeta.meta_key = ‘wp_3_capabilities’ ) from do_action_ref_array, call_user_func_array, Yoast_Tracking->tracking, W3_Db->query, W3_DbCache->query, W3_DbCallUnderlying->query, W3_Db->query, W3_DbProcessor->query, W3_Db->default_query
    [15-Aug-2013 15:49:25 UTC] WordPress database error Table ‘xxxx_dbsp.wp_users’ doesn’t exist for query SELECT COUNT(*) FROM wp_users INNER JOIN wp_usermeta ON (wp_users.ID = wp_usermeta.user_id) WHERE 1 = 1 AND ( wp_usermeta.meta_key = ‘wp_1_capabilities’ ) made by do_action_ref_array, call_user_func_array, Yoast_Tracking->tracking, W3_Db->query, W3_DbCache->query, W3_DbCallUnderlying->query, W3_Db->query, W3_DbProcessor->query, W3_Db->default_query
    [15-Aug-2013 15:53:23 UTC] WordPress database error Table ‘xxxx_dbsp.wp_users’ doesn’t exist for query SELECT COUNT(*) FROM wp_users INNER JOIN wp_usermeta ON (wp_users.ID = wp_usermeta.user_id) WHERE 1 = 1 AND ( wp_usermeta.meta_key = ‘wp_2_capabilities’ ) made by do_action_ref_array, call_user_func_array, Yoast_Tracking->tracking, W3_Db->query, W3_DbCache->query, W3_DbCallUnderlying->query, W3_Db->query, W3_DbProcessor->query, W3_Db->default_query

    for secutiry reasons i have change the prefix “wp_”, but why he tried to find the deafualt? how can I fix this?

    I don’t think this is correct, actually. object-cache.php doesn’t call w3-total-cache/lib/W3/Cache/Apc.php directly. In fact, it first calls ObjectCache.php, and only from there does it call to Apc.php, Memcached, php, etc.

    The order of params is actually correct once you look at set() in w3-total-cache/lib/W3/ObjectCache.php.

    I did, however, just spent days on figuring out why object caching doesn’t work reliably, and I have figured it out after much blood, sweat, and tears.

    I’m going to post it separately, drop a link here, and attempt to get in contact with Frederick once again.

    Plugin Author Frederick Townes

    (@fredericktownes)

    As a more robust fix replace all $group = ‘0’ with $group = ” in all source files (will affect files in /Cache folder + one file from pgcache).

    Indeed, that’s another fix that should resolve the underlying issue of mismatching params.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Bug in APC object cache wp_cache_set() making it fail’ is closed to new replies.