Follow-up r63213. Move it to wfEscapeShellArg, which is the proper place.
authorPlatonides <platonides@users.mediawiki.org>
Wed, 3 Mar 2010 18:22:26 +0000 (18:22 +0000)
committerPlatonides <platonides@users.mediawiki.org>
Wed, 3 Mar 2010 18:22:26 +0000 (18:22 +0000)
includes/GlobalFunctions.php
includes/Math.php

index 2c24af0..3a48326 100644 (file)
@@ -1460,13 +1460,17 @@ function wfEscapeShellArg( ) {
                                }
                                $delim = !$delim;
                        }
+                       
                        // Double the backslashes before the end of the string, because
                        // we will soon add a quote
                        $m = array();
                        if ( preg_match( '/^(.*?)(\\\\+)$/', $arg, $m ) ) {
                                $arg = $m[1] . str_replace( '\\', '\\\\', $m[2] );
                        }
-
+                       
+                       // The caret is also an special character
+                       $arg = str_replace( "^", "^^", $arg );
+                       
                        // Add surrounding quotes
                        $retVal .= '"' . $arg . '"';
                } else {
index af0a64a..8cf9b8d 100644 (file)
@@ -67,7 +67,7 @@ class MathRenderer {
 
                        if ( wfIsWindows() ) {
                                # Invoke it within cygwin sh, because texvc expects sh features in its default shell
-                               $cmd = 'sh -c ' . wfEscapeShellArg( str_replace( "^", "^^", $cmd ) );
+                               $cmd = 'sh -c ' . wfEscapeShellArg( $cmd );
                        }
 
                        wfDebug( "TeX: $cmd\n" );