Fix edit link for messages in $wgForceUIMsgAsContentMsg
[lhc/web/wiklou.git] / includes / Xml.php
index 159f711..f0bd70b 100644 (file)
@@ -94,9 +94,7 @@ class Xml {
                        $attribs = array_map( array( 'UtfNormal', 'cleanUp' ), $attribs );
                }
                if ( $contents ) {
-                       wfProfileIn( __METHOD__ . '-norm' );
                        $contents = $wgContLang->normalize( $contents );
-                       wfProfileOut( __METHOD__ . '-norm' );
                }
                return self::element( $element, $attribs, $contents );
        }
@@ -368,12 +366,10 @@ class Xml {
        public static function label( $label, $id, $attribs = array() ) {
                $a = array( 'for' => $id );
 
-               # FIXME avoid copy pasting below:
-               if ( isset( $attribs['class'] ) ) {
-                               $a['class'] = $attribs['class'];
-               }
-               if ( isset( $attribs['title'] ) ) {
-                               $a['title'] = $attribs['title'];
+               foreach ( array( 'class', 'title' ) as $attr ) {
+                       if ( isset( $attribs[$attr] ) ) {
+                               $a[$attr] = $attribs[$attr];
+                       }
                }
 
                return self::element( 'label', $a, $label );
@@ -707,13 +703,15 @@ class Xml {
        /**
         * Check if a string is well-formed XML.
         * Must include the surrounding tag.
+        * This function is a DoS vector if an attacker can define
+        * entities in $text.
         *
         * @param string $text String to test.
         * @return bool
         *
         * @todo Error position reporting return
         */
-       public static function isWellFormed( $text ) {
+       private static function isWellFormed( $text ) {
                $parser = xml_parser_create( "UTF-8" );
 
                # case folding violates XML standard, turn it off