Merge "Added $ttl sanity check to WANObjectCache::delete()"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Tue, 25 Aug 2015 22:12:35 +0000 (22:12 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Tue, 25 Aug 2015 22:12:35 +0000 (22:12 +0000)
1  2 
includes/libs/objectcache/WANObjectCache.php

@@@ -272,6 -272,8 +272,8 @@@ class WANObjectCache 
         */
        final public function delete( $key, $ttl = self::HOLDOFF_TTL ) {
                $key = self::VALUE_KEY_PREFIX . $key;
+               // Avoid indefinite key salting for sanity
+               $ttl = max( $ttl, 1 );
                // Update the local cluster immediately
                $ok = $this->cache->set( $key, self::PURGE_VAL_PREFIX . microtime( true ), $ttl );
                // Publish the purge to all clusters
         * moves from $lowTTL to 0 seconds. This handles widely varying
         * levels of cache access traffic.
         *
 -       * @param float|INF $curTTL Approximate TTL left on the key if present
 +       * @param float $curTTL Approximate TTL left on the key if present
         * @param float $lowTTL Consider a refresh when $curTTL is less than this
         * @return bool
         */