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

Wikimedia Bugzilla is closed!

Wikimedia has migrated from Bugzilla to Phabricator. Bug reports should be created and updated in Wikimedia Phabricator instead. Please create an account in Phabricator and add your Bugzilla email address to it.
Wikimedia Bugzilla is read-only. If you try to edit or create any bug report in Bugzilla you will be shown an intentional error message.
In order to access the Phabricator task corresponding to a Bugzilla report, just remove "static-" from its URL.
You could still run searches in Bugzilla or access your list of votes but bug reports will obviously not be up-to-date in Bugzilla.
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)
PC Linux
: Normal normal (vote)
: ---
Assigned To: Nobody - You can work on this!
Depends on:
  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: ---


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',
'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 =

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.