From ae80e25b5619bba314362d0f64d526bbb8fef75c Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Sat, 22 Oct 2005 23:06:03 +0000 Subject: [PATCH] * Fix wfMsg*() replacements; args containing literal $[2-9] were wiped --- RELEASE-NOTES | 1 + includes/GlobalFunctions.php | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) 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; } -- 2.20.1