r22832 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r22831‎ | r22832 | r22833 >
Date:01:06, 8 June 2007
Author:greg
Status:old
Tags:
Comment:
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.
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/Math.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/Math.php
@@ -157,8 +157,8 @@
158158 $dbw = wfGetDB( DB_MASTER );
159159 $dbw->replace( 'math', array( 'math_inputhash' ),
160160 array(
161 - 'math_inputhash' => $md5_sql,
162 - 'math_outputhash' => $outmd5_sql,
 161+ 'math_inputhash' => $dbw->encodeBlob($md5_sql),
 162+ 'math_outputhash' => $dbw->encodeBlob($outmd5_sql),
163163 'math_html_conservativeness' => $this->conservativeness,
164164 'math_html' => $this->html,
165165 'math_mathml' => $this->mathml,
@@ -186,13 +186,13 @@
187187 $dbr = wfGetDB( DB_SLAVE );
188188 $rpage = $dbr->selectRow( 'math',
189189 array( 'math_outputhash','math_html_conservativeness','math_html','math_mathml' ),
190 - array( 'math_inputhash' => pack("H32", $this->md5)), # Binary packed, not hex
 190+ array( 'math_inputhash' => $dbr->encodeBlob(pack("H32", $this->md5))), # Binary packed, not hex
191191 $fname
192192 );
193193
194194 if( $rpage !== false ) {
195195 # Tailing 0x20s can get dropped by the database, add it back on if necessary:
196 - $xhash = unpack( 'H32md5', $rpage->math_outputhash . " " );
 196+ $xhash = unpack( 'H32md5', $dbr->decodeBlob($rpage->math_outputhash) . " " );
197197 $this->hash = $xhash ['md5'];
198198
199199 $this->conservativeness = $rpage->math_html_conservativeness;
Index: trunk/phase3/RELEASE-NOTES
@@ -142,6 +142,8 @@
143143 * Fix maintenance/importImages.php so it doesn't barf PHP errors when no suitable
144144 files are found, and make the list of extensions an option (defaults to
145145 $wgFileExtensions)
 146+* (bug 9909) Ensure access to binary fields in the math table use encodeBlob()
 147+ and decodeBlob.
146148
147149 == MediaWiki API changes since 1.10 ==
148150

Follow-up revisions

RevisionCommit summaryAuthorDate
r22857Merged revisions 22811-22855 via svnmerge from...david00:48, 9 June 2007

Status & tagging log