From: Leszek Manicki Date: Wed, 16 Mar 2016 16:07:31 +0000 (+0100) Subject: Fix ApiQueryInfo response for prop=watchers X-Git-Tag: 1.31.0-rc.0~7589^2 X-Git-Url: http://git.cyclocoop.org/%7B%24admin_url%7Dmes_infos.php?a=commitdiff_plain;h=4ec20438abf56977b185896e597d0db33c0bbffa;p=lhc%2Fweb%2Fwiklou.git 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 --- 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; } }