From: Brion Vibber Date: Sat, 22 Oct 2005 23:06:03 +0000 (+0000) Subject: * Fix wfMsg*() replacements; args containing literal $[2-9] were wiped X-Git-Tag: 1.6.0~1351 X-Git-Url: http://git.cyclocoop.org/%22.%24h.%22?a=commitdiff_plain;h=ae80e25b5619bba314362d0f64d526bbb8fef75c;p=lhc%2Fweb%2Fwiklou.git * Fix wfMsg*() replacements; args containing literal $[2-9] were wiped --- diff --git a/RELEASE-NOTES b/RELEASE-NOTES index e22fa66cf1..5d750c86ea 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -164,6 +164,7 @@ fully support the editing toolbar, but was found to be too confusing. * Wrap message page insertions in a transaction to speed up installation * Avoid notice warning on edit with no User-Agent header * Various fixes +* Fix wfMsg*() replacements; args containing literal $[2-9] were wiped === Caveats === diff --git a/includes/GlobalFunctions.php b/includes/GlobalFunctions.php index 50f6302ff0..367adf39d9 100644 --- a/includes/GlobalFunctions.php +++ b/includes/GlobalFunctions.php @@ -404,15 +404,16 @@ function wfMsgGetKey( $key, $useDB, $forContent = false ) { * @access private */ function wfMsgReplaceArgs( $message, $args ) { - static $replacementKeys = array( '$1', '$2', '$3', '$4', '$5', '$6', '$7', '$8', '$9' ); - # Fix windows line-endings # Some messages are split with explode("\n", $msg) $message = str_replace( "\r", '', $message ); # Replace arguments if( count( $args ) ) { - $message = str_replace( $replacementKeys, $args, $message ); + foreach( $args as $n => $param ) { + $replacementKeys['$' . ($n + 1)] = $param; + } + $message = strtr( $message, $replacementKeys ); } return $message; }