From: Brion Vibber Date: Sun, 28 May 2006 09:31:04 +0000 (+0000) Subject: Had to revert the changes in r14424 / r14427 due to massive side-effect breakage... X-Git-Tag: 1.31.0-rc.0~56998 X-Git-Url: http://git.cyclocoop.org/%28?a=commitdiff_plain;h=f6a581a9b95c66b52b9004c2cdfad7c3548c33b0;p=lhc%2Fweb%2Fwiklou.git Had to revert the changes in r14424 / r14427 due to massive side-effect breakage on zh.wikipedia.org: * Move parameter replacement before brace transformations in most of the wfMsg() family (except for wfMsgHtml). This allows things like {{plural:}}, {{urlencode:}}, and {{fullurl:}} to be used in most cases correctly. The content or UI language will be used accordingly for (forContent)?. * Work around glitch with the above in {{int:}}; skip redundant transformations, allow the including parser to do it. * Fix {{int:}} to use content language, so it won't break caches and links tables and randomly include data from the wrong language. Uncertain what the cause is of the breakage, I have a hard time duplicating it and it looks massively wrong (should not be possible). Failure on Parser.php line 590, claims var not array, but the check two lines above ensures that it is first... --- diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 9f6f61b6a5..411606c944 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -359,14 +359,6 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN under HTML-compatible browsers. * (bug 5077) Added hook 'BeforePageDisplay' to SkinTemplate::outputPage * Replace fatally changed 'uploadnewversion' with 'uploadnewversion-linktext' -* Move parameter replacement before brace transformations in most of the - wfMsg() family (except for wfMsgHtml). This allows things like {{plural:}}, - {{urlencode:}}, and {{fullurl:}} to be used in most cases correctly. - The content or UI language will be used accordingly for (forContent)?. -* Work around glitch with the above in {{int:}}; skip redundant transformations, - allow the including parser to do it. -* Fix {{int:}} to use content language, so it won't break caches and links - tables and randomly include data from the wrong language. * (bug 472) Syndication feeds for the last few edits of page history * Format edit comments in Recent Changes feed * Switch incorrectly ordered column headers on Recent Changes feed diffs diff --git a/includes/GlobalFunctions.php b/includes/GlobalFunctions.php index 7498a35f2a..cbd58214de 100644 --- a/includes/GlobalFunctions.php +++ b/includes/GlobalFunctions.php @@ -310,10 +310,6 @@ function wfReadOnly() { * addWikiText will do the escaping for you. Use wfMsgHtml() * if you need an escaped message. * - * Brace transformation is done *after* parameter replacement, so - * constructs like {{plural:$1}} may be used. Be aware this may - * have security implications for HTML message output. - * * @param $key String: lookup key for the message, usually * defined in languages/Language.php */ @@ -351,10 +347,6 @@ function wfMsgNoTrans( $key ) { * customize over 70 messages in order to, e.g., fix a link in every * possible language. * - * Brace transformation is done *after* parameter replacement, so - * constructs like {{plural:$1}} may be used. Be aware this may - * have security implications for HTML message output. - * * @param $key String: lookup key for the message, usually * defined in languages/Language.php */ @@ -385,10 +377,6 @@ function wfMsgForContentNoTrans( $key ) { /** * Get a message from the language file, for the UI elements - * - * Brace transformation is done *after* parameter replacement, so - * constructs like {{plural:$1}} may be used. Be aware this may - * have security implications for HTML message output. */ function wfMsgNoDB( $key ) { $args = func_get_args(); @@ -398,10 +386,6 @@ function wfMsgNoDB( $key ) { /** * Get a message from the language file, for the content - * - * Brace transformation is done *after* parameter replacement, so - * constructs like {{plural:$1}} may be used. Be aware this may - * have security implications for HTML message output. */ function wfMsgNoDBForContent( $key ) { global $wgForceUIMsgAsContentMsg; @@ -417,11 +401,6 @@ function wfMsgNoDBForContent( $key ) { /** * Really get a message - * - * Brace transformation is done *after* parameter replacement, so - * constructs like {{plural:$1}} may be used. Be aware this may - * have security implications for HTML message output. - * * @return $key String: key to get. * @return $args * @return $useDB Boolean @@ -430,14 +409,8 @@ function wfMsgNoDBForContent( $key ) { function wfMsgReal( $key, $args, $useDB, $forContent=false, $transform = true ) { $fname = 'wfMsgReal'; - $message = wfMsgGetKey( $key, $useDB, $forContent, false ); + $message = wfMsgGetKey( $key, $useDB, $forContent, $transform ); $message = wfMsgReplaceArgs( $message, $args ); - if( $transform && strstr( $message, '{{' ) !== false ) { - global $wgParser, $wgMsgParserOptions; - $old = $wgMsgParserOptions->setInterfaceMessage( !$forContent ); - $message = $wgParser->transformMsg($message, $wgMsgParserOptions); - $wgMsgParserOptions->setInterfaceMessage( $old ); - } return $message; } @@ -543,9 +516,6 @@ function wfMsgReplaceArgs( $message, $args ) { * to pre-escape them if you really do want plaintext, or just wrap * the whole thing in htmlspecialchars(). * - * Brace transformation is done *before* parameter replacement, so - * constructs like {{plural:$1}} will not work. - * * @param string $key * @param string ... parameters * @return string @@ -563,9 +533,6 @@ function wfMsgHtml( $key ) { * to pre-escape them if you really do want plaintext, or just wrap * the whole thing in htmlspecialchars(). * - * Brace transformation is done *before* parameter replacement, so - * constructs like {{plural:$1}} will not work. - * * @param string $key * @param string ... parameters * @return string diff --git a/includes/Parser.php b/includes/Parser.php index 17ffdd4107..a0673a8eca 100644 --- a/includes/Parser.php +++ b/includes/Parser.php @@ -2574,8 +2574,7 @@ class Parser $mwInt =& MagicWord::get( MAG_INT ); if ( $mwInt->matchStartAndRemove( $part1 ) ) { if ( $this->incrementIncludeCount( 'int:'.$part1 ) ) { - $text = $linestart . wfMsgReal( $part1, $args, true, - /* ui language */false, /* transform */false ); + $text = $linestart . wfMsgReal( $part1, $args, true ); $found = true; } }