Avoid PHP warning if key is not set in getValidationHash()
authorAaron Schulz <aschulz@wikimedia.org>
Thu, 3 Sep 2015 05:10:45 +0000 (22:10 -0700)
committerOri.livneh <ori@wikimedia.org>
Fri, 4 Sep 2015 00:43:55 +0000 (00:43 +0000)
* Follow up to 2be60e777

Change-Id: Ic5c27226bc3f5cc870728a925b504a0dcbedaefb

includes/cache/MessageCache.php

index 9a6f7d0..f22c860 100644 (file)
@@ -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 );
        }
 
        /**