This avoids returning possible html tags like <var> for {{int:var}}.
Bug: T44914
Change-Id: Ibcba9129d88510e6a84282c774ebe2dbfa548462
if ( strval( $part1 ) !== '' ) {
$args = array_slice( func_get_args(), 2 );
$message = wfMessage( $part1, $args )
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 );
}
} else {
return array( 'found' => false );
}
+!! test
+int keyword - non-existing message
+!! wikitext
+{{int:var}}
+!! html
+<p><var>
+</p>
+!! end
+
!! article
Template:Includes
!! text
!! article
Template:Includes
!! text