From 152638e907bc0ba13c155a095e8178b9e2590669 Mon Sep 17 00:00:00 2001 From: Alexandre Emsenhuber Date: Wed, 26 Aug 2009 15:47:03 +0000 Subject: [PATCH] =?utf8?q?*=20(bug=208143)=20Localised=20parser=20function?= =?utf8?q?=20names=20are=20now=20correctly=20case=20insensitive=20if=20the?= =?utf8?q?y=20contain=20non-ASCII=20characters=20Patch=20by=20Mat=C4=9Bj?= =?utf8?q?=20Grabovsk=C3=BD=20-=20http://bug-attachment.wikimedia.org/atta?= =?utf8?q?chment.cgi=3Fid=3D6406?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- CREDITS | 1 + RELEASE-NOTES | 2 ++ includes/parser/Parser.php | 6 ++++-- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/CREDITS b/CREDITS index fe776b6b28..714d6cdb87 100644 --- a/CREDITS +++ b/CREDITS @@ -82,6 +82,7 @@ following names for their contribution to the product. * Marcin Cieślak * Marcus Buck * Marooned +* Matěj Grabovský * mati * Max Semenik * Michael De La Rue diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 17e6fb0d20..3e205e4e17 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -434,6 +434,8 @@ this. Was used when mwEmbed was going to be an extension. the file description page instead of MediaWiki:License * (bug 20380) Link to history/log action at the top of Special:RevisionDelete are new more displayed when when doing log suppression +* (bug 8143) Localised parser function names are now correctly case insensitive + if they contain non-ASCII characters == API changes in 1.16 == diff --git a/includes/parser/Parser.php b/includes/parser/Parser.php index ec9ff0d28a..78fd7a0b07 100644 --- a/includes/parser/Parser.php +++ b/includes/parser/Parser.php @@ -2760,7 +2760,7 @@ class Parser $function = $this->mFunctionSynonyms[1][$function]; } else { # Case insensitive functions - $function = strtolower( $function ); + $function = $wgContLang->lc( $function ); if ( isset( $this->mFunctionSynonyms[0][$function] ) ) { $function = $this->mFunctionSynonyms[0][$function]; } else { @@ -4140,6 +4140,8 @@ class Parser * @return The old callback function for this name, if any */ function setFunctionHook( $id, $callback, $flags = 0 ) { + global $wgContLang; + $oldVal = isset( $this->mFunctionHooks[$id] ) ? $this->mFunctionHooks[$id][0] : null; $this->mFunctionHooks[$id] = array( $callback, $flags ); @@ -4154,7 +4156,7 @@ class Parser foreach ( $synonyms as $syn ) { # Case if ( !$sensitive ) { - $syn = strtolower( $syn ); + $syn = $wgContLang->lc( $syn ); } # Add leading hash if ( !( $flags & SFH_NO_HASH ) ) { -- 2.20.1