Last modified: 2007-04-10 10:25:18 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T11546, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 9546 - PostgreSQL validates UTF8 feilds, which makes the use of pack in Math.php unacceptable.
PostgreSQL validates UTF8 feilds, which makes the use of pack in Math.php una...
Status: RESOLVED DUPLICATE of bug 8716
Product: MediaWiki
Classification: Unclassified
Database (Other open bugs)
unspecified
PC Linux
: Normal normal (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2007-04-10 10:23 UTC by Ian Kumlien
Modified: 2007-04-10 10:25 UTC (History)
0 users

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Ian Kumlien 2007-04-10 10:23:14 UTC
I thought i had put up a bug about this somewhere, including a patch, but i
might have been on sf...

The use of pack in Math.php breaks because PostgreSQL, quite correctly,
validates it's utf8 input. Once upon a time i had a proper patch for this, but
now i only have a 1.9.2 diff against 1.9.3...

Anyways, to give a understanding of the changes that should be made:
@@ -153,9 +152,9 @@
 
                        # Now save it back to the DB:
                        if ( !wfReadOnly() ) {
-                               $outmd5_sql = $this->hash;
+                               $outmd5_sql = pack('H32', $this->hash);
 
-                               $md5_sql = $this->md5;
+                               $md5_sql = pack('H32', $this->md5); # Binary
packed, not hex
 
                                $dbw =& wfGetDB( DB_MASTER );
                                $dbw->replace( 'math', array( 'math_inputhash' ),
@@ -189,12 +188,13 @@
                $dbr =& wfGetDB( DB_SLAVE );
                $rpage = $dbr->selectRow( 'math',
                        array(
'math_outputhash','math_html_conservativeness','math_html','math_mathml' ),
-                       array( 'math_inputhash' => $this->md5), $fname
+                       array( 'math_inputhash' => 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 = $rpage->math_outputhash;
+                       $xhash = unpack( 'H32md5', $rpage->math_outputhash . " 
              " );
                        $this->hash = $xhash ['md5'];
 
                        $this->conservativeness =
$rpage->math_html_conservativeness;

I do, however assume that $fname has been added since i changed my version...
Comment 1 Rob Church 2007-04-10 10:25:18 UTC

*** This bug has been marked as a duplicate of 8716 ***

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links