Fix ApiQueryInfo response for prop=watchers
[lhc/web/wiklou.git] / includes / api / ApiQueryInfo.php
index 3aa0122..f33da1e 100644 (file)
@@ -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;
                        }
                }