Add "mVersion" sanity check to User::loadFromCache()
authorAaron Schulz <aschulz@wikimedia.org>
Sat, 14 May 2016 11:03:39 +0000 (04:03 -0700)
committerAaron Schulz <aschulz@wikimedia.org>
Sat, 14 May 2016 11:03:39 +0000 (04:03 -0700)
This makes it easier to transition to a newer, versioned key format
while still using Het Deploy as normal.

Change-Id: I732af860ba4ea70cc7d1cc5bf46fc09fc35d7502

includes/user/User.php

index b5384bc..6bfc3a4 100644 (file)
@@ -499,7 +499,10 @@ class User implements IDBAccessObject {
                $data = $processCache->get( $key );
                if ( !is_array( $data ) ) {
                        $data = $cache->get( $key );
-                       if ( !is_array( $data ) || $data['mVersion'] < self::VERSION ) {
+                       if ( !is_array( $data )
+                               || !isset( $data['mVersion'] )
+                               || $data['mVersion'] < self::VERSION
+                       ) {
                                // Object is expired
                                return false;
                        }