Page MenuHomePhabricator

Object of class Blob could not be converted to string
Closed, ResolvedPublic

Description

Author: joshua

Description:
Trying to create or run a math page results in a 500 page error. looking in apache log you see

PHP Catchable fatal error: Object of class Blob could not be converted to string in /var/www/rnd-wiki/extensions/Math/MathRenderer.php on line 162.

Database is Postgresql
Server is Ubuntu 64bit


Version: REL1_21-branch
Severity: critical

Details

Reference
bz50235

Event Timeline

bzimport raised the priority of this task from to High.Nov 22 2014, 2:07 AM
bzimport added a project: Math.
bzimport set Reference to bz50235.
bzimport added a subscriber: Unknown Object (MLST).

physik wrote:

I'll have a look at this problem, which version of Postgresql do you use?

joshua wrote:

9.1.9

i'd be happy to do a join.me or something like that to let you look into it

Installed software

Product Version
MediaWiki 1.21.1
PHP 5.4.9-4ubuntu2.1 (apache2handler)
PostgreSQL 9.1.9
BlueSpice for MediaWiki 1.21.0

joshua wrote:

(In reply to comment #1)

I'll have a look at this problem, which version of Postgresql do you use?

9.1.9

i'd be happy to do a join.me or something like that to let you look into it

Installed software

Product Version
MediaWiki 1.21.1
PHP 5.4.9-4ubuntu2.1 (apache2handler)
PostgreSQL 9.1.9
BlueSpice for MediaWiki 1.21.0

physik wrote:

Hi,

a quick fix is to uncomment this line, since it only prints out debug output.
I'll try to get a postgresql instance to submit a proper fix.

Best
Physikerwelt

joshua wrote:

its not commented for me
wfDebugLog( "Math", 'store entry for $' . $this->tex . '$ in database (hash:' . $this->getInputHash() . ')\n' );

joshua wrote:

now im getting

Failed to parse (PNG conversion failed; check for correct installation of latex and dvipng (or dvips + gs + convert)): s_k

physik wrote:

sorry I mean comment it out, i.e.
// wfDebugLog( "Math", 'store entry for $' . $this->tex . '$ in database (hash:'
. $this->getInputHash() . ')\n' );

a real fix could be to replace the line by
wfDebugLog( "Math", 'store entry for $' . $this->tex . '$ in database (hash:' . var_export( $this->getInputHash() , false ) . ')\n' );

physik wrote:

(In reply to comment #6)

now im getting

Failed to parse (PNG conversion failed; check for correct installation of
latex
and dvipng (or dvips + gs + convert)): s_k

Ok this is quite normal if you have not installed latex and dvipng.
You can try out MathML rendering which does not require Latex to be installed
by setting

$wgUseLaTeXML = true; enabeling MathJax as rendering option
$wgDefaultUserOptions['math'] = MW_MATH_LATEXML;
setting LaTeXML as default rendering option (optional)

in the LocalSettings.php file.
See
http://www.mediawiki.org/wiki/Extension:Math
for more information.

joshua wrote:

tried that and its still coming up with the same error someone said in the render.ml they had to define the absolute path of latex and dvipng.

do you know these?

physik wrote:

I probably can not fix the original bug. In the latest version the debug output is

wfDebugLog( "Math", 'store entry for $' . $this->tex . '$ in database (hash:' . $this->hash . ')\n' );

this should not cause problems since it is a text field.

So the general solution would be to update to the latest version.

joshua wrote:

i am at the latest stable version

physik wrote:

I know it's a little bit hard to fix errors, since the page is cached and the cache stores the errors as well.
So if you change something in the config, you have to add ?action=purge to the url in order to trigger another run of the math extension code.

physik wrote:

Yes. I know. Maybe there should be a new release since that version is 4 month old.

physik wrote:

(In reply to comment #8)

(In reply to comment #6)

now im getting

Failed to parse (PNG conversion failed; check for correct installation of
latex
and dvipng (or dvips + gs + convert)): s_k

Ok this is quite normal if you have not installed latex and dvipng.
You can try out MathML rendering which does not require Latex to be installed
by setting

$wgUseLaTeXML = true; enabeling MathJax as rendering option
$wgDefaultUserOptions['math'] = MW_MATH_LATEXML;
setting LaTeXML as
default
rendering option (optional)

in the LocalSettings.php file.
See
http://www.mediawiki.org/wiki/Extension:Math
for more information.

does that work for you?

joshua wrote:

nope

this is what i have

require_once("$IP/extensions/Math/Math.php");
$wgTmpDirectory = "$wgScriptPath/images/tmp";
$wgTexvc = '/var/www/rnd-wiki/extensions/Math/math/texvc';
$wgUseLaTeXML = true; // enabeling MathJax as rendering option
$wgDefaultUserOptions['math'] = MW_MATH_LATEXML;

joshua wrote:

in my apache error log you see

Use of undefined constant MW_MATH_LATEXML - assumed 'MW_MATH_LATEXML'

physik wrote:

oh sorry my fault.

This only works with the current master branch
if you use git try

cd extensions
git clone https://gerrit.wikimedia.org/r/p/mediawiki/extensions/Math.git
git checkout master

in that case this config should be sufficient

require_once("$IP/extensions/Math/Math.php");
$wgTmpDirectory = "$wgScriptPath/images/tmp";
$wgTexvc = '/var/www/rnd-wiki/extensions/Math/math/texvc';
$wgUseLaTeXML = true; // enabeling MathJax as rendering option
$wgDefaultUserOptions['math'] = MW_MATH_LATEXML;

joshua wrote:

Failed to parse (LaTeXML MathML is invalid XML.): C_{f_q}

physik wrote:

ok. yet another problem. This is because the a dependency to a newer version of the core.

You can update your core version to the master version as well by
git checkout master in the mediawiki root dir, or uncomment the xml check in
MathLaTeXML.php line 204

 	/**
	 * Checks if the input is valid MathML,
	 * and if the root element has the name math
	 * @param string $XML
	 * @return boolean
	 */

static public function isValidMathML( $XML ) {

just add return true; there.

See gerrit 60987 for the blob fix

sumanah wrote:

Since the change has been merged, can we close this bug as resolved?