Index: Math.php =================================================================== --- Math.php (revision 32481) +++ Math.php (working copy) @@ -55,15 +55,32 @@ if( function_exists( 'is_executable' ) && !is_executable( $wgTexvc ) ) { return $this->_error( 'math_notexvc' ); } + if ( !wfIsWindows() ) { + $cmd = $wgTexvc . ' ' . - escapeshellarg( $wgTmpDirectory ).' '. - escapeshellarg( $wgTmpDirectory ).' '. - escapeshellarg( $this->tex ).' '. - escapeshellarg( $wgInputEncoding ); - if ( wfIsWindows() ) { - # Invoke it within cygwin sh, because texvc expects sh features in its default shell - $cmd = 'sh -c ' . wfEscapeShellArg( $cmd ); + escapeshellarg( $wgTmpDirectory ).' '. + + escapeshellarg( $wgTmpDirectory ).' '. + + escapeshellarg( $this->tex ).' '. + + escapeshellarg( $wgInputEncoding ); + + } + else { + # change backslashes to slashes + $wgTexvc = str_replace( "\\", "/", $wgTexvc ); + + $wgTmpDirectory = str_replace( "\\", "/", $wgTmpDirectory ); + # quote with single quotes like escapeshellarg under Unix + $cmd = $wgTexvc . " '" . + str_replace( "'", "'\\''", $wgTmpDirectory )."' '". + str_replace( "'", "'\\''", $wgTmpDirectory )."' '". + str_replace( "'", "'\\''", $this->tex )."' '". + str_replace( "'", "'\\''", $wgInputEncoding )."'"; + # Invoke it within cygwin sh, because texvc expects sh features in its default shell + $cmd = 'sh -c ' . wfEscapeShellArg( $cmd ); } wfDebug( "TeX: $cmd\n" );