Improving r29456:
authorRoan Kattouw <catrope@users.mediawiki.org>
Tue, 8 Jan 2008 22:05:39 +0000 (22:05 +0000)
committerRoan Kattouw <catrope@users.mediawiki.org>
Tue, 8 Jan 2008 22:05:39 +0000 (22:05 +0000)
* The XML formatting bug is obscure and not trivial to fix, working around it is easier
* Added missing braces

includes/api/ApiQueryInfo.php

index f98a4d0..4c90f8d 100644 (file)
@@ -201,12 +201,15 @@ class ApiQueryInfo extends ApiQueryBase {
                                if($tok_protect)
                                        $res['query']['pages'][$pageid]['protecttoken'] = $wgUser->editToken();
                                if($fld_protection)
-                                       // FIXME: Fix XML formatter
+                               {
+                                       // Apparently the XML formatting code doesn't like array(null)
+                                       // This is painful to fix, so we'll just work around it
                                        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');
+                                       $result->setIndexedTagName($res['query']['pages'][$pageid]['protection'], 'pr');
+                               }
                        }
                }
        }