From 4ec20438abf56977b185896e597d0db33c0bbffa Mon Sep 17 00:00:00 2001 From: Leszek Manicki Date: Wed, 16 Mar 2016 17:07:31 +0100 Subject: [PATCH] Fix ApiQueryInfo response for prop=watchers Ie84e6feaa42db1bc7a1f89b56aed37dd7fe95ea4 part of them problem with incorrect API response but if when no watchers data is fetched (ie. due to early return in ApiQueryInfo::getWatcherInfo), response contains "watchers": null instead of skipping "watchers" key entirely. Bug: T129482 Change-Id: I9cab120ec4e6a9cf4626678e45ef14ea8efc8cbc --- includes/api/ApiQueryInfo.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/includes/api/ApiQueryInfo.php b/includes/api/ApiQueryInfo.php index 3aa0122d7d..f33da1e486 100644 --- a/includes/api/ApiQueryInfo.php +++ b/includes/api/ApiQueryInfo.php @@ -453,8 +453,10 @@ class ApiQueryInfo extends ApiQueryBase { } if ( $this->fld_watchers ) { - if ( $this->watchers[$ns][$dbkey] !== 0 || $this->showZeroWatchers ) { + if ( $this->watchers !== null && $this->watchers[$ns][$dbkey] !== 0 ) { $pageInfo['watchers'] = $this->watchers[$ns][$dbkey]; + } elseif ( $this->showZeroWatchers ) { + $pageInfo['watchers'] = 0; } } -- 2.20.1