From: Aaron Schulz Date: Thu, 3 Sep 2015 05:10:45 +0000 (-0700) Subject: Avoid PHP warning if key is not set in getValidationHash() X-Git-Tag: 1.31.0-rc.0~10150 X-Git-Url: http://git.cyclocoop.org///%22%40url%40//%22?a=commitdiff_plain;h=4eea6b5d71af0475f430fc9d68b922080f65ef14;p=lhc%2Fweb%2Fwiklou.git Avoid PHP warning if key is not set in getValidationHash() * Follow up to 2be60e777 Change-Id: Ic5c27226bc3f5cc870728a925b504a0dcbedaefb --- diff --git a/includes/cache/MessageCache.php b/includes/cache/MessageCache.php index 9a6f7d0688..f22c860afa 100644 --- a/includes/cache/MessageCache.php +++ b/includes/cache/MessageCache.php @@ -645,16 +645,20 @@ class MessageCache { if ( !$value ) { // No hash found at all; cache must regenerate to be safe + $hash = false; $expired = true; - } elseif ( ( time() - $value['latest'] ) < WANObjectCache::HOLDOFF_TTL ) { - // Cache was recently updated via replace() and should be up-to-date - $expired = false; } else { - // See if the "check" key was bumped after the hash was generated - $expired = ( $curTTL < 0 ); + $hash = $value['hash']; + if ( ( time() - $value['latest'] ) < WANObjectCache::HOLDOFF_TTL ) { + // Cache was recently updated via replace() and should be up-to-date + $expired = false; + } else { + // See if the "check" key was bumped after the hash was generated + $expired = ( $curTTL < 0 ); + } } - return array( $value['hash'], $expired ); + return array( $hash, $expired ); } /**