Tobias Gritschacher has submitted this change and it was merged.

Change subject: Make EntityLookup robust against version issues.
......................................................................


Make EntityLookup robust against version issues.

Change-Id: Ibfb9880cc48efe536318581262d2ad74d5684bab
---
M lib/includes/store/sql/WikiPageEntityLookup.php
1 file changed, 7 insertions(+), 3 deletions(-)

Approvals:
  Tobias Gritschacher: Verified; Looks good to me, approved



diff --git a/lib/includes/store/sql/WikiPageEntityLookup.php 
b/lib/includes/store/sql/WikiPageEntityLookup.php
index aac9929..c6825b3 100644
--- a/lib/includes/store/sql/WikiPageEntityLookup.php
+++ b/lib/includes/store/sql/WikiPageEntityLookup.php
@@ -127,7 +127,7 @@
                        $cache = wfGetCache( $this->cacheType );
                        $cached = $cache->get( $cacheKey );
 
-                       if ( $cached ) {
+                       if ( $cached && is_array( $cached ) ) {
                                wfDebugLog( __CLASS__, __FUNCTION__ . ": Found 
entity in cache (key $cacheKey)" );
                                list( $cachedRev, $cachedEntity ) = $cached;
 
@@ -304,8 +304,12 @@
                $format = $row->rev_content_format;
                $entity = EntityFactory::singleton()->newFromBlob( $entityType, 
$blob, $format );
 
-               wfDebugLog( __CLASS__, __FUNCTION__ . ": Created entity object 
from revision blob: "
-                       . $entity->getId()->getPrefixedId() );
+               if ( $entity->getId() ) {
+                       wfDebugLog( __CLASS__, __FUNCTION__ . ": Created entity 
object from revision blob: "
+                               . $entity->getId()->getPrefixedId() );
+               } else {
+                       wfLogWarning( __METHOD__ . ": Entity object from 
revision blob does not contain an ID!" );
+               }
 
                wfProfileOut( __METHOD__ );
                return $entity;

-- 
To view, visit https://gerrit.wikimedia.org/r/70637
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ibfb9880cc48efe536318581262d2ad74d5684bab
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: mw1.22-wmf6
Gerrit-Owner: Daniel Kinzler <daniel.kinz...@wikimedia.de>
Gerrit-Reviewer: Tobias Gritschacher <tobias.gritschac...@wikimedia.de>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to