From: Greg Sabino Mullane Date: Fri, 8 Jun 2007 01:06:52 +0000 (+0000) Subject: Have Math.php use encodeBlob and decodeBlob when accessing the binary fields math_inp... X-Git-Tag: 1.31.0-rc.0~52620 X-Git-Url: https://git.cyclocoop.org/%20%27.%28%24debut%20%20%20%24par_page%29.%27?a=commitdiff_plain;h=ac059274ecd8b58662041f55efc17cbaee2504c0;p=lhc%2Fweb%2Fwiklou.git Have Math.php use encodeBlob and decodeBlob when accessing the binary fields math_inputhash and math_outputhash. Better long-term solution is to simply store the hexadecimal as text, but converting via updaters.inc will be complex. Fixes bug # 9909. --- diff --git a/RELEASE-NOTES b/RELEASE-NOTES index d946df00ef..ef16df33c4 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -142,6 +142,8 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN * Fix maintenance/importImages.php so it doesn't barf PHP errors when no suitable files are found, and make the list of extensions an option (defaults to $wgFileExtensions) +* (bug 9909) Ensure access to binary fields in the math table use encodeBlob() + and decodeBlob. == MediaWiki API changes since 1.10 == diff --git a/includes/Math.php b/includes/Math.php index 88934e5f0c..f0465240b1 100644 --- a/includes/Math.php +++ b/includes/Math.php @@ -157,8 +157,8 @@ class MathRenderer { $dbw = wfGetDB( DB_MASTER ); $dbw->replace( 'math', array( 'math_inputhash' ), array( - 'math_inputhash' => $md5_sql, - 'math_outputhash' => $outmd5_sql, + 'math_inputhash' => $dbw->encodeBlob($md5_sql), + 'math_outputhash' => $dbw->encodeBlob($outmd5_sql), 'math_html_conservativeness' => $this->conservativeness, 'math_html' => $this->html, 'math_mathml' => $this->mathml, @@ -186,13 +186,13 @@ class MathRenderer { $dbr = wfGetDB( DB_SLAVE ); $rpage = $dbr->selectRow( 'math', array( 'math_outputhash','math_html_conservativeness','math_html','math_mathml' ), - array( 'math_inputhash' => pack("H32", $this->md5)), # Binary packed, not hex + array( 'math_inputhash' => $dbr->encodeBlob(pack("H32", $this->md5))), # Binary packed, not hex $fname ); if( $rpage !== false ) { # Tailing 0x20s can get dropped by the database, add it back on if necessary: - $xhash = unpack( 'H32md5', $rpage->math_outputhash . " " ); + $xhash = unpack( 'H32md5', $dbr->decodeBlob($rpage->math_outputhash) . " " ); $this->hash = $xhash ['md5']; $this->conservativeness = $rpage->math_html_conservativeness;