From: Niklas Laxström Date: Sun, 8 Oct 2006 13:00:42 +0000 (+0000) Subject: * (bug 7459) Magic word variables are always case sensitive X-Git-Tag: 1.31.0-rc.0~55588 X-Git-Url: http://git.cyclocoop.org/%24href?a=commitdiff_plain;h=78034ed0d1c5a7577875eecdfe8f309c96217a2e;p=lhc%2Fweb%2Fwiklou.git * (bug 7459) Magic word variables are always case sensitive --- diff --git a/RELEASE-NOTES b/RELEASE-NOTES index bb60b2ad81..4381ae4806 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -271,6 +271,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN * (bug 7499) Corrections to Swedish talk namespace names * (bug 7508) Added option to compress HTML pages by dumpHTML.php * (bug 7519) Add plural in SpecialWatchlist +* (bug 7459) Magic word variables are always case sensitive == Languages updated == diff --git a/includes/MagicWord.php b/includes/MagicWord.php index 511efab4cf..68cbe34531 100644 --- a/includes/MagicWord.php +++ b/includes/MagicWord.php @@ -178,7 +178,7 @@ class MagicWord { $escSyn[] = preg_quote( $synonym, '/' ); $this->mBaseRegex = implode( '|', $escSyn ); - $case = $this->mCaseSensitive ? '' : 'i'; + $case = $this->mCaseSensitive ? '' : 'iu'; $this->mRegex = "/{$this->mBaseRegex}/{$case}"; $this->mRegexStart = "/^(?:{$this->mBaseRegex})/{$case}"; $this->mVariableRegex = str_replace( "\\$1", "(.*?)", $this->mRegex ); @@ -205,7 +205,7 @@ class MagicWord { if ( $this->mRegex === '' ) $this->initRegex(); - return $this->mCaseSensitive ? '' : 'i'; + return $this->mCaseSensitive ? '' : 'iu'; } /** @@ -378,8 +378,9 @@ class MagicWord { * lookup in a list of magic words */ function addToArray( &$array, $value ) { + global $wgContLang; foreach ( $this->mSynonyms as $syn ) { - $array[$syn] = $value; + $array[$wgContLang->lc($syn)] = $value; } } diff --git a/includes/Parser.php b/includes/Parser.php index 64810090d3..bf386aed05 100644 --- a/includes/Parser.php +++ b/includes/Parser.php @@ -2758,8 +2758,9 @@ class Parser * @private */ function variableSubstitution( $matches ) { + global $wgContLang; $fname = 'Parser::variableSubstitution'; - $varname = $matches[1]; + $varname = $wgContLang->lc($matches[1]); wfProfileIn( $fname ); $skip = false; if ( $this->mOutputType == OT_WIKI ) { @@ -2773,8 +2774,14 @@ class Parser } if ( !$skip && array_key_exists( $varname, $this->mVariables ) ) { $id = $this->mVariables[$varname]; - $text = $this->getVariableValue( $id ); - $this->mOutput->mContainsOldMagic = true; + # Now check if we did really match, case sensitive or not + $mw =& MagicWord::get( $id ); + if ($mw->match($matches[1])) { + $text = $this->getVariableValue( $id ); + $this->mOutput->mContainsOldMagic = true; + } else { + $text = $matches[0]; + } } else { $text = $matches[0]; }