(bug 45130) Fix siprop=protocols in XML format
authorAlex Monk <krenair@gmail.com>
Mon, 18 Feb 2013 20:57:00 +0000 (20:57 +0000)
committerAlex Monk <krenair@gmail.com>
Mon, 18 Feb 2013 21:04:31 +0000 (21:04 +0000)
Change-Id: I2362be19f1e8f759e574d85ed210978c0fbd53a3

includes/api/ApiQuerySiteinfo.php

index 593d6e7..624711a 100644 (file)
@@ -554,8 +554,10 @@ class ApiQuerySiteinfo extends ApiQueryBase {
 
        public function appendProtocols( $property ) {
                global $wgUrlProtocols;
-               $this->getResult()->setIndexedTagName( $wgUrlProtocols, 'p' );
-               return $this->getResult()->addValue( 'query', $property, $wgUrlProtocols );
+               // Make a copy of the global so we don't try to set the _element key of it - bug 45130
+               $protocols = array_values( $wgUrlProtocols );
+               $this->getResult()->setIndexedTagName( $protocols, 'p' );
+               return $this->getResult()->addValue( 'query', $property, $protocols );
        }
 
        private function formatParserTags( $item ) {