ApiQueryWatchlist: Handle empty wltypes
authorBrad Jorsch <bjorsch@wikimedia.org>
Tue, 20 Dec 2016 19:40:03 +0000 (14:40 -0500)
committerBrad Jorsch <bjorsch@wikimedia.org>
Tue, 20 Dec 2016 19:40:03 +0000 (14:40 -0500)
The pre-WatchedItemQueryService code used ApiQueyrBase::addWhereFld()
which filters out empty arrays. WatchedItemQueryService doesn't do that.

Bug: T153733
Change-Id: I3416b5a05c9751303b5c28a8b6d9cb746a101f73

includes/api/ApiQueryWatchlist.php

index 6b5ceb7..3f59751 100644 (file)
@@ -151,7 +151,10 @@ class ApiQueryWatchlist extends ApiQueryGeneratorBase {
 
                if ( !is_null( $params['type'] ) ) {
                        try {
-                               $options['rcTypes'] = RecentChange::parseToRCType( $params['type'] );
+                               $rcTypes = RecentChange::parseToRCType( $params['type'] );
+                               if ( $rcTypes ) {
+                                       $options['rcTypes'] = $rcTypes;
+                               }
                        } catch ( Exception $e ) {
                                ApiBase::dieDebug( __METHOD__, $e->getMessage() );
                        }