Added trim() call to work around mystery bug where whitespace gets appended to single...
authorBrion Vibber <brion@users.mediawiki.org>
Fri, 14 Aug 2009 01:30:56 +0000 (01:30 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Fri, 14 Aug 2009 01:30:56 +0000 (01:30 +0000)
Examples from reading in extension .i18n files:
-    'quiz_reset' => 'Reset',
+    'quiz_reset' => 'Reset"',

-    'very-special-message' => 'Aren\'t I special?',
+    'very-special-message' => 'Aren\'t I special?"
+ ',

-    'nss-db-error' => 'Error reading from authentication database',
+    'nss-db-error' => 'Error reading from authentication database\'',

includes/ConfEditor.php

index 9c8ebb6..d8b3da8 100644 (file)
@@ -306,11 +306,17 @@ class ConfEditor {
        function parseScalar( $str ) {
                if ( $str !== '' && $str[0] == '\'' )
                        // Single-quoted string
-                       return strtr( substr( $str, 1, -1 ),
+                       // @fixme trim() call is due to mystery bug where whitespace gets
+                       // appended to the token; without it we ended up reading in the
+                       // extra quote on the end!
+                       return strtr( substr( trim( $str ), 1, -1 ),
                                array( '\\\'' => '\'', '\\\\' => '\\' ) );
                if ( $str !== '' && @$str[0] == '"' )
                        // Double-quoted string
-                       return stripcslashes( substr( $str, 1, -1 ) );
+                       // @fixme trim() call is due to mystery bug where whitespace gets
+                       // appended to the token; without it we ended up reading in the
+                       // extra quote on the end!
+                       return stripcslashes( substr( trim( $str ), 1, -1 ) );
                if ( substr( $str, 0, 4 ) == 'true' )
                        return true;
                if ( substr( $str, 0, 5 ) == 'false' )