Last modified: 2012-08-04 20:48:45 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 T11909, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 9909 - Math rendering with TeX on postgres requires use of pg_escape_bytea()
Math rendering with TeX on postgres requires use of pg_escape_bytea()
Product: MediaWiki
Classification: Unclassified
Database (Other open bugs)
PC Linux
: Normal normal (vote)
: ---
Assigned To: Nobody - You can work on this!
: 10780 (view as bug list)
Depends on:
Blocks: postgres
  Show dependency treegraph
Reported: 2007-05-14 15:51 UTC by Olaf Lenzmann
Modified: 2012-08-04 20:48 UTC (History)
3 users (show)

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


Description Olaf Lenzmann 2007-05-14 15:51:17 UTC
On a postgres-based install (UTF-8 encoding), the database barfs on binary
values for the math_inputhash and math_outputhash columns in the SQL, reporting
invalid UTF-8 chars; the byte arrays need to be escaped with pg_escape_bytea()

A database error has occurred Query: SELECT
math_outputhash,math_html_conservativeness,math_html,math_mathml FROM math WHERE
math_inputhash = '� |(�ɖ�e�\\�' LIMIT 1 Function: MathRenderer::_recall
Error: 1 ERROR: invalid byte sequence for encoding "UTF8": 0xce0d


#0 /storage/www/htdocs/wiki/includes/Database.php(761):
DatabasePostgres->reportQueryError('ERROR: invalid...', 1, 'SELECT math_ou...',
'MathRenderer::_...', false)
#1 /storage/www/htdocs/wiki/includes/Database.php(1179): Database->query('SELECT
math_ou...', 'MathRenderer::_...')
#2 /storage/www/htdocs/wiki/includes/Database.php(1198):
Database->select('math', Array, Array, 'MathRenderer::_...', Array)
#3 /storage/www/htdocs/wiki/includes/Math.php(191): Database->selectRow('math',
Array, Array, 'MathRenderer::_...')
#4 /storage/www/htdocs/wiki/includes/Math.php(44): MathRenderer->_recall()
#5 /storage/www/htdocs/wiki/includes/Math.php(269): MathRenderer->render()
#6 /storage/www/htdocs/wiki/includes/Parser.php(590):
MathRenderer::renderMath('Insert formula ...')
#7 /storage/www/htdocs/wiki/includes/Parser.php(300): Parser->strip('This
section de...', Object(StripState))
#8 /storage/www/htdocs/wiki/includes/Article.php(2289): Parser->parse('This
section de...', Object(Title), Object(ParserOptions), true, true, 30)
#9 /storage/www/htdocs/wiki/includes/Article.php(1380):
Article->editUpdates('This section de...', '', true, '20070514154832', 30, false)
#10 /storage/www/htdocs/wiki/includes/Article.php(1205): Article->doEdit('This
section de...', '', 102)
#11 /storage/www/htdocs/wiki/includes/EditPage.php(865):
Article->updateArticle('This section de...', '', true, false, '', '')
#12 /storage/www/htdocs/wiki/includes/EditPage.php(426): EditPage->attemptSave()
#13 /storage/www/htdocs/wiki/includes/EditPage.php(279): EditPage->edit()
#14 /storage/www/htdocs/wiki/includes/Wiki.php(432): EditPage->submit()
#15 /storage/www/htdocs/wiki/includes/Wiki.php(48):
MediaWiki->performAction(Object(OutputPage), Object(Article), Object(Title),
Object(User), Object(WebRequest))
#16 /storage/www/htdocs/wiki/index.php(89): MediaWiki->initialize(Object(Title),
Object(OutputPage), Object(User), Object(WebRequest))
#17 {main}
Comment 1 Antoine "hashar" Musso (WMF) 2007-05-17 10:48:12 UTC
blocks bug 384
Comment 2 Greg Sabino Mullane 2007-06-08 01:07:53 UTC
Patch applied in r22832. Thanks for the report. Someday, we'll flip those fields back to simple text and not do all that pack() and unpack().
Comment 3 Mika Fischer 2007-07-20 15:31:46 UTC
Just a note for other people trying to fix this in their installations:

The patch above will *not* work for version 1.10.1 because encodeBlob returns an array in this version. In SVN trunk it only returns the encoded value.

So you need to extract the second value from the array you get from encodeBlob and then pass this on to the database functions.
Comment 4 Brion Vibber 2007-08-08 17:30:41 UTC
*** Bug 10780 has been marked as a duplicate of this bug. ***

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