From 1aaec79b5879e526effb2f28679c1805b2aec351 Mon Sep 17 00:00:00 2001 From: Roan Kattouw Date: Tue, 8 Jan 2008 21:42:00 +0000 Subject: [PATCH] API: Temporary fix for broken XML rendering; XML formatter apparently doesn't like array(null). Will attempt to fix the real issue later --- includes/api/ApiQueryInfo.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/includes/api/ApiQueryInfo.php b/includes/api/ApiQueryInfo.php index 1450ad1718..f98a4d0760 100644 --- a/includes/api/ApiQueryInfo.php +++ b/includes/api/ApiQueryInfo.php @@ -109,6 +109,7 @@ class ApiQueryInfo extends ApiQueryBase { $this->addFields(array('pt_title', 'pt_namespace', 'pt_create_perm', 'pt_expiry')); $this->addWhere($lb->constructSet('pt', $db)); $res = $this->select(__METHOD__); + $prottitles = array(); while($row = $db->fetchObject($res)) { $prottitles[$row->pt_namespace][$row->pt_title] = array( 'type' => 'create', @@ -200,7 +201,11 @@ class ApiQueryInfo extends ApiQueryBase { if($tok_protect) $res['query']['pages'][$pageid]['protecttoken'] = $wgUser->editToken(); if($fld_protection) - $res['query']['pages'][$pageid]['protection'][] = $prottitles[$title->getNamespace()][$title->getDbKey()]; + // FIXME: Fix XML formatter + if(isset($prottitles[$title->getNamespace()][$title->getDbKey()])) + $res['query']['pages'][$pageid]['protection'][] = $prottitles[$title->getNamespace()][$title->getDbKey()]; + else + $res['query']['pages'][$pageid]['protection'] = array(); $result->setIndexedTagName($res['query']['pages'][$pageid]['protection'], 'pr'); } } -- 2.20.1