From ff83048597fb256c2579f16ddcd982ef2ae75460 Mon Sep 17 00:00:00 2001 From: Moritz Schubotz Date: Fri, 7 Feb 2014 09:32:23 +0100 Subject: [PATCH] fix: texvccheck is not idempotent The output of texvccheck is not only "checked" but also rewritten to another form. (For example $\R$ is transformed to $\mathbb{R}$.) But the output might not be a valid input for the thexvccheck part of texvc, like it happened in for the example given in the bug description. See also I599c4390da9b8f36d800f379a33ad5ce90f5096c Bug: 61012 Change-Id: Iae5e350cb78c0e637e574390c586fbdb8dc38496 --- MathRenderer.php | 9 ++++++++- MathTexvc.php | 4 ++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/MathRenderer.php b/MathRenderer.php index 2f0b16cdf..925321fbd 100644 --- a/MathRenderer.php +++ b/MathRenderer.php @@ -137,7 +137,7 @@ abstract class MathRenderer { public function getInputHash() { // TODO: What happens if $tex is empty? $dbr = wfGetDB( DB_SLAVE ); - return $dbr->encodeBlob( pack( "H32", md5( $this->tex ) ) ); # Binary packed, not hex + return $dbr->encodeBlob( pack( "H32", md5( $this->getUserInputTex() ) ) ); # Binary packed, not hex } /** @@ -443,5 +443,12 @@ abstract class MathRenderer { } } } + + /** + * @return string original tex string specified by the user + */ + public function getUserInputTex(){ + return $this->userInputTex; + } } diff --git a/MathTexvc.php b/MathTexvc.php index 1c69d47ca..89eb94ddc 100644 --- a/MathTexvc.php +++ b/MathTexvc.php @@ -110,7 +110,7 @@ class MathTexvc extends MathRenderer { * @return int|string MW_TEXVC_SUCCESS or error string */ public function callTexvc() { - global $wgTexvc, $wgTexvcBackgroundColor, $wgUseSquid, $wgMathCheckFiles, $wgHooks; + global $wgTexvc, $wgTexvcBackgroundColor, $wgHooks; wfProfileIn( __METHOD__ ); $tmpDir = wfTempDir(); @@ -125,7 +125,7 @@ class MathTexvc extends MathRenderer { $cmd = $wgTexvc . ' ' . $escapedTmpDir . ' ' . $escapedTmpDir . ' ' . - wfEscapeShellArg( $this->getTex() ) . ' ' . + wfEscapeShellArg( $this->getUserInputTex() ) . ' ' . wfEscapeShellArg( 'UTF-8' ) . ' ' . wfEscapeShellArg( $wgTexvcBackgroundColor );