From 634b81f8d0fc3058e54256f1d49061ee1998c9a8 Mon Sep 17 00:00:00 2001 From: Platonides Date: Wed, 3 Mar 2010 18:22:26 +0000 Subject: [PATCH] Follow-up r63213. Move it to wfEscapeShellArg, which is the proper place. --- includes/GlobalFunctions.php | 6 +++++- includes/Math.php | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/includes/GlobalFunctions.php b/includes/GlobalFunctions.php index 2c24af0465..3a48326751 100644 --- a/includes/GlobalFunctions.php +++ b/includes/GlobalFunctions.php @@ -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 { diff --git a/includes/Math.php b/includes/Math.php index af0a64aae4..8cf9b8d897 100644 --- a/includes/Math.php +++ b/includes/Math.php @@ -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" ); -- 2.20.1