Tobias Gritschacher has submitted this change and it was merged.

Change subject: (Bug 45881) Stop use of entity ids with wrong prefix
......................................................................


(Bug 45881) Stop use of entity ids with wrong prefix

It seems to me that this fix is sufficient and it is only the explicitly given 
entity id that is misinterpreted.

Change-Id: Iafaca93b79d5ee2d7b9cd72d2a24fae5ba0f8d51
---
M repo/includes/api/SearchEntities.php
1 file changed, 2 insertions(+), 1 deletion(-)

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



diff --git a/repo/includes/api/SearchEntities.php 
b/repo/includes/api/SearchEntities.php
index 2da7df9..f8e31b4 100644
--- a/repo/includes/api/SearchEntities.php
+++ b/repo/includes/api/SearchEntities.php
@@ -98,7 +98,7 @@
                        $page = 
EntityContentFactory::singleton()->getWikiPageForId( $entityId );
                        if ( $page->exists() ) {
                                $entityContent = $page->getContent();
-                               if ( $entityContent instanceof 
\Wikibase\EntityContent ) {
+                               if ( ( $entityContent instanceof 
\Wikibase\EntityContent ) && ( $entityContent->getEntity()->getType() === 
$params['type'] ) ) {
                                        $ids[] = $entityId;
                                }
                        }
@@ -115,6 +115,7 @@
                        $ids = array_merge( $ids, $this->searchEntities( 
$params['language'], $params['search'], $params['type'], $limit, true ) );
                        $ids = array_unique( $ids );
                }
+
                // reduce any overflow
                $ids = array_slice ( $ids, 0, $limit );
 

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Iafaca93b79d5ee2d7b9cd72d2a24fae5ba0f8d51
Gerrit-PatchSet: 4
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: John Erling Blad <[email protected]>
Gerrit-Reviewer: Tobias Gritschacher <[email protected]>
Gerrit-Reviewer: jenkins-bot

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to