Merge "Escape return of {{int:}} if message not exists"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Wed, 19 Aug 2015 17:31:48 +0000 (17:31 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Wed, 19 Aug 2015 17:31:48 +0000 (17:31 +0000)
includes/parser/CoreParserFunctions.php
tests/parser/parserTests.txt

index 8a30ad1..7639e2f 100644 (file)
@@ -88,9 +88,13 @@ class CoreParserFunctions {
                if ( strval( $part1 ) !== '' ) {
                        $args = array_slice( func_get_args(), 2 );
                        $message = wfMessage( $part1, $args )
-                               ->inLanguage( $parser->getOptions()->getUserLangObj() )->plain();
-
-                       return array( $message, 'noparse' => false );
+                               ->inLanguage( $parser->getOptions()->getUserLangObj() );
+                       if ( !$message->exists() ) {
+                               // When message does not exists, the message name is surrounded by angle
+                               // and can result in a tag, therefore escape the angles
+                               return $message->escaped();
+                       }
+                       return array( $message->plain(), 'noparse' => false );
                } else {
                        return array( 'found' => false );
                }
index 9d46b12..f70a1b0 100644 (file)
@@ -10476,6 +10476,15 @@ int keyword
 </p>
 !! end
 
+!! test
+int keyword - non-existing message
+!! wikitext
+{{int:var}}
+!! html
+<p>&lt;var&gt;
+</p>
+!! end
+
 !! article
 Template:Includes
 !! text