From: Tim Starling Date: Sat, 20 Aug 2005 15:28:53 +0000 (+0000) Subject: Fixed odd breakage of templates involving '{{bar}}'... X-Git-Tag: 1.6.0~1866 X-Git-Url: http://git.cyclocoop.org/%22%20.%20generer_url_ecrire%28%22articles%22%2C%22id_article=%24id_article%22%29%20.%20%22?a=commitdiff_plain;h=5eb9056704a935e639a0daee881b24c2fae7033a;p=lhc%2Fweb%2Fwiklou.git Fixed odd breakage of templates involving '{{bar}}'. {{bar}} was expanded without any arguments passed from the parent page. The problem was $this->mAssocArgs being overwritten by the call to replaceVariables() from within Sanitizer::removeHTMLtags(), and thus subtly corrupted for the subsequent call from braceSubstitution() itself. I've forgotten why I made that a class member in the first place, but making it a local instead doesn't break any parser tests, so it's a sufficient solution as far as I'm concerned. --- diff --git a/includes/Parser.php b/includes/Parser.php index eede52aeba..8e8175c944 100644 --- a/includes/Parser.php +++ b/includes/Parser.php @@ -111,7 +111,6 @@ class Parser // in this path. Used for loop detection. var $mIWTransData = array(); - var $mAssocArgs = array(); /**#@-*/ @@ -2246,7 +2245,6 @@ class Parser if ( $this->mOutputType == OT_HTML && !$found ) { $text = '[['.$title->getPrefixedText().']]'; $found = true; - } # Template cache array insertion if( $found ) { @@ -2262,12 +2260,12 @@ class Parser $text = wfEscapeWikiText( $text ); } elseif ( ($this->mOutputType == OT_HTML || $this->mOutputType == OT_WIKI) && $found && !$noparse) { # Clean up argument array - $this->mAssocArgs = array(); + $assocArgs = array(); $index = 1; foreach( $args as $arg ) { $eqpos = strpos( $arg, '=' ); if ( $eqpos === false ) { - $this->mAssocArgs[$index++] = $arg; + $assocArgs[$index++] = $arg; } else { $name = trim( substr( $arg, 0, $eqpos ) ); $value = trim( substr( $arg, $eqpos+1 ) ); @@ -2275,7 +2273,7 @@ class Parser $value = ''; } if ( $name !== false ) { - $this->mAssocArgs[$name] = $value; + $assocArgs[$name] = $value; } } } @@ -2289,9 +2287,9 @@ class Parser $text = strtr( $text, array( '' => '' , '' => '' ) ); # Strip ,
, etc.
 				$text = $this->strip( $text, $this->mStripState );
-				$text = Sanitizer::removeHTMLtags( $text, array( &$this, 'replaceVariables' ), $this->mAssocArgs );
+				$text = Sanitizer::removeHTMLtags( $text, array( &$this, 'replaceVariables' ), $assocArgs );
 			}
-			$text = $this->replaceVariables( $text, $this->mAssocArgs );
+			$text = $this->replaceVariables( $text, $assocArgs );
 
 			# Resume the link cache and register the inclusion as a link
 			if ( $this->mOutputType == OT_HTML && !is_null( $title ) ) {