The trick is not to replaceVariables() ourselves, but to leave that to the preprocessor,
which is then correctly detecting the loop.
if ( strval( $part1 ) !== '' ) {
$args = array_slice( func_get_args(), 2 );
$message = wfMessage( $part1, $args )->inLanguage( $parser->getOptions()->getUserLangObj() )->plain();
- $message = $parser->replaceVariables( $message ); // like MessageCache::transform()
- return $message;
+ return array( $message, 'noparse' => false );
} else {
return array( 'found' => false );
}
!! test
Bug 31098 Template which includes system messages which includes the template
-!! options
-disabled
!! input
{{Identical}}
!! result
-...
+<p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
+<span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
+</p>
!! end
!! test