Warn if stateful ParserOutput transforms are used
[lhc/web/wiklou.git] / includes / parser / CoreParserFunctions.php
index 3d26262..07944d4 100644 (file)
@@ -875,7 +875,7 @@ class CoreParserFunctions {
                $code = strtolower( $code );
                $inLanguage = strtolower( $inLanguage );
                $lang = Language::fetchLanguageName( $code, $inLanguage );
-               return $lang !== '' ? $lang : wfBCP47( $code );
+               return $lang !== '' ? $lang : LanguageCode::bcp47( $code );
        }
 
        /**
@@ -930,7 +930,8 @@ class CoreParserFunctions {
         */
        public static function anchorencode( $parser, $text ) {
                $text = $parser->killMarkers( $text );
-               return (string)substr( $parser->guessSectionNameFromWikiText( $text ), 1 );
+               $section = (string)substr( $parser->guessSectionNameFromWikiText( $text ), 1 );
+               return Sanitizer::safeEncodeAttribute( $section );
        }
 
        public static function special( $parser, $text ) {