Page MenuHomePhabricator

Use of medium space throws database error
Closed, ResolvedPublic


See summary. Steps to reproduce (tested on dewiki):

  1. Create a new page.
  2. Insert <math>\:</math> (i.e. the medium space in math mode)
  3. Click on "Preview"

This results in the following error message:

"Es ist ein Datenbankfehler aufgetreten. Der Grund kann ein Programmierfehler sein. Die letzte Datenbankabfrage lautete:
(Die SQL-Datenbankabfrage ist verborgen.)
aus der Funktion „MathRenderer::writeDBEntry“. Die Datenbank meldete den Fehler „1048: Column 'math_outputhash' cannot be null (“."

Version: unspecified
Severity: normal



Event Timeline

bzimport raised the priority of this task from to Medium.Nov 22 2014, 1:40 AM
bzimport added a project: Math.
bzimport set Reference to bz46042.
bzimport added a subscriber: Unknown Object (MLST).

It looks like some error scenario is not being handled, so the hash ends up staying null, and the code tries to write it to the database, which should not happen.

Note, it happens on other equations, not only when the equation is *only* a space. E.g.

<math>x = h + j \:</math>

			if ( $this->hash ) {
				$outmd5_sql = $dbw->encodeBlob( pack( 'H32', $this->hash ) );
			} else {
				$outmd5_sql = null;

  -- Not sure what this is, exactly...
  math_outputhash varbinary(16) NOT NULL,


physik wrote:

@sam that simply wrong. I have used for LaTeXML where I allowed for null values if no math image has been generated. But it should not appear here. If $this->hash is not set this leads to an error as well.

I can not reproduce the error:

I would be highly interested why I can't.

(In reply to comment #3)

@sam that simply wrong.

I pasted the code that's there. Not my fault.

I can reproduce it. That obviously is the code that's there on master:;a=blob;f=MathRenderer.php;h=10676aa91d9d0f843a3b123757d4173dbbb5f2d2;hb=HEAD#l160

Clearly (both from the bug report and looking at the code), null is not getting caught before the DB insert.

physik wrote:

@sam: I didn't want to say that your are wrong. Just wanted to say that the code should not be in the master branch.

physik wrote:

@Matthew: Do you get an error or do you see the expected output?

bugaroosa wrote:

I am also seeing this, and it is hindering my work proofreading scientific texts on wikisource. I created a page on the 4th of March with two medium spaces perfectly fine but now I cannot even delete them or edit the existing page.


  • Bug 46080 has been marked as a duplicate of this bug. ***

Yes, when I reproduced it, I got the error.

(In reply to comment #11)

The problem can also be seen on the German help page for TeX:

Apparently you "just" have to remove

  • <math>a_{1</math>
  • <math>\frak{1}{2}</math>
  • <math>ä </math>
  • <math>Oberfläche_\mathrm{Kugel} \, = 4 \pi r^2 </math>
  • <math>\mathop{\large \sqcap} V</math>
  • <math>\mathop{\large \sqcup} V</math>
  • <math>\mathop{\Large \sqcap} V</math>

to make that page usable again.

physik wrote:

Thank you very much for your input.
I can not fix the bug since, I can not reproduce it.

On pt, i've crossed with this case:
The math code was incorrect, so instead of the usual <math> error red output, there was the db one. Fixing the formula,the problem went away.

physik wrote:

Can someone confirm that it is fixed. Rendering the former page leads to the following red text for me:

Falhou ao verificar gramática (Erro de sintaxe): x_{i+1} = x_i - {{f(x_i)}} \over {f'(x_i)}} = x_i - {{sin(x_i)}} \over {cos(x_i)}}= x_i - {{tan(x_i)}},

(In reply to comment #15)

Can someone confirm that it is fixed.

Apparently, yes. I cannot reproduce the database error in the example originally reported, looks fine now, and so does the ptwiki page.