SubscriptionStore: Allow empty array to be passed to fetchSubscriptions

Change-Id: Ib2b659645ed55bc7a64f9971f0e054907c86a552
This commit is contained in:
Ed Sanders 2021-05-05 19:16:54 +01:00
parent c618139b9c
commit 11d40d2663

View file

@ -8,6 +8,7 @@ use MediaWiki\User\UserIdentity;
use ReadOnlyMode;
use stdClass;
use TitleValue;
use Wikimedia\Rdbms\FakeResultWrapper;
use Wikimedia\Rdbms\IDatabase;
use Wikimedia\Rdbms\ILBFactory;
use Wikimedia\Rdbms\ILoadBalancer;
@ -75,6 +76,11 @@ class SubscriptionStore {
}
if ( $itemNames !== null ) {
if ( !count( $itemNames ) ) {
// We are not allowed to construct a filter with an empty array.
// Any empty array should result in no items being returned.
return new FakeResultWrapper( [] );
}
$conditions[ 'sub_item' ] = $itemNames;
}