Bug 31098: Template loop through MediaWiki: messages (int: function) not being detected.
authorPlatonides <platonides@users.mediawiki.org>
Sat, 29 Oct 2011 22:22:51 +0000 (22:22 +0000)
committerPlatonides <platonides@users.mediawiki.org>
Sat, 29 Oct 2011 22:22:51 +0000 (22:22 +0000)
The trick is not to replaceVariables() ourselves, but to leave that to the preprocessor,
which is then correctly detecting the loop.

includes/parser/CoreParserFunctions.php
tests/parser/parserTests.txt

index 70e9b01..cd5e0a5 100644 (file)
@@ -98,8 +98,7 @@ class CoreParserFunctions {
                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 );
                }
index e96f724..390ad06 100644 (file)
@@ -8795,12 +8795,12 @@ Template:Identical
 
 !! 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