* Fix wfMsg*() replacements; args containing literal $[2-9] were wiped
authorBrion Vibber <brion@users.mediawiki.org>
Sat, 22 Oct 2005 23:06:03 +0000 (23:06 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Sat, 22 Oct 2005 23:06:03 +0000 (23:06 +0000)
RELEASE-NOTES
includes/GlobalFunctions.php

index e22fa66..5d750c8 100644 (file)
@@ -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 ===
index 50f6302..367adf3 100644 (file)
@@ -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;
 }