mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/PageImages
synced 2024-11-24 00:13:27 +00:00
Ensure array is passed to getProperties
PageImages::getPropNames can return either array or string, and PageProps::getProperties accepts both. But the latter's return value will be different depending on the type of input: with an array as input, the returned array's values will be an associative array where the index is the propname; with a string, it's just the propvalue. This difference matters because the code below assumes an array with propname keys. Bug: T323152 Change-Id: I422951ec0cd5c651b32c65e88a557d49f2f22712
This commit is contained in:
parent
d7d9c0275f
commit
c75b00d14d
|
@ -53,7 +53,7 @@ class SearchResultProvideThumbnailHookHandler implements SearchResultProvideThum
|
|||
$propValues = $this->pageProps->getProperties(
|
||||
$nonFileIdentitiesByPageId,
|
||||
// T320661: only provide free images for search purposes
|
||||
PageImages::getPropNames( PageImages::LICENSE_FREE )
|
||||
(array)PageImages::getPropNames( PageImages::LICENSE_FREE )
|
||||
);
|
||||
$fileNames = array_map( static function ( $prop ) {
|
||||
return $prop[ PageImages::getPropName( false ) ]
|
||||
|
|
|
@ -116,7 +116,7 @@ class SearchResultProvideThumbnailHookHandlerTest extends MediaWikiIntegrationTe
|
|||
->method( 'getProperties' )
|
||||
->with(
|
||||
$this->anything(),
|
||||
PageImages::getPropNames( PageImages::LICENSE_FREE )
|
||||
(array)PageImages::getPropNames( PageImages::LICENSE_FREE )
|
||||
)->willReturn( [
|
||||
1 => [
|
||||
PageImages::getPropName( true ) => 'File1_free.jpg'
|
||||
|
|
Loading…
Reference in a new issue