Support » Plugin: Memcached Object Cache » [Plugin: Memcached Object Cache] 'checkthedatabaseplease' == $value is true for int(0)

  • Resolved Joe Hoyle

    (@joehoyle)


    I am not sure why the ‘checkthedatabaseplease’ is there, but if you are trying to store / get “int(0)” as the data, then this check succeeds in both places, when I presume it should not. 'checkthedatabaseplease' == 0 is bool(true).

    This means it is not possible to store int(0) in object cache.

    http://wordpress.org/extend/plugins/memcached/

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Matt Martz

    (@sivel)

    Your assumption is incorrect. We are comparing ‘checkthedatabaseplease’ against the value retrieved by memcached. And ‘checkthedatabaseplease’ does not evaluate to 0.

    The actual code snippets are:

    WP_Object_Cache::get

    if ( 'checkthedatabaseplease' === $value ) {
    			unset( $this->cache[$key] );
    			$value = false;
    		}

    WP_Object_Cache::set

    if ( isset($this->cache[$key]) && ('checkthedatabaseplease' === $this->cache[$key]) )
    			return false;

    So in your case for WP_Object_Cache::get, it would be performing the following evaluation:

    if ( 'checkthedatabaseplease' === 0 ) { which would return false, not true, since they are obviously not the same values.

    This allows us to store a value of ‘checkthedatabaseplease’ in memcached, to get the calling function to believe no data was returned and to look at the database for the correct data.

    Forgive me for my ignorance, but I really don’t see how I am incorrect here.

    >> if ( ‘checkthedatabaseplease’ === 0 ) { which would return false, not true, since they are obviously not the same values.

    That’s not what it does, it does if ( 'checkthedatabaseplease' == 0 ) which is (bool) true

    Plugin Author Matt Martz

    (@sivel)

    Ah, I see where you and I are on different pages. Apparently that change was fixed 13 months ago in the development version ( http://plugins.trac.wordpress.org/changeset?reponame=&new=427207%40memcached%2Ftrunk%2Fobject-cache.php&old=425137%40memcached%2Ftrunk%2Fobject-cache.php ), however we haven’t pushed a new release in 15 months.

    I will push a new release soon.

    Plugin Author Matt Martz

    (@sivel)

    Ok, I have tagged a new release. 2.0.2 is showing up in the repo now.

    Ahh great, thanks Matt!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘[Plugin: Memcached Object Cache] 'checkthedatabaseplease' == $value is true for int(0)’ is closed to new replies.