Page MenuHomePhabricator

parser returns without generating output
Closed, ResolvedPublic

Description

Author: etherboot

Description:
I'm using the parser standalone to parse Wiki text to be stored into a string and then sent via AJAX to an iframe. The code is running in the context of a Mediawiki as an extension. I have found that the parser returns prematurely without generating any output when I call $wgOut->parse().

I have traced it to these lines in formatHeaders in Parser.php. When I comment these lines out, the parser works without returning prematurely.

if( !$this->mTitle->quickUserCan( 'edit' ) ) {
$showEditLink = 0;
} else {
$showEditLink = $this->mOptions->getEditSection();
}

Is there a problem with quickUserCan? Is mTitle not initialised properly when I use the parser standalone?

This did not happen in 1.12 so I think it is something new in 1.13.


Version: 1.13.x
Severity: major
OS: Linux
Platform: PC

Details

Reference
bz15618

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 10:22 PM
bzimport set Reference to bz15618.
bzimport added a subscriber: Unknown Object (MLST).

Are you sure it doesn't throw any errors or warnings? Also, Bugzilla is not a good place to get development help.

etherboot wrote:

No, it exits the program at that point, as any echo statements placed after that point do not execute and generate output. Apache error_log shows nothing amiss. access_log shows a transfer of 0 bytes. I ought to turn on more debugging options in PHP.

I don't need development help, I've worked around the problem by commenting those lines out which don't appear to do anything useful for me. I'm just very surprised that a PHP program can exit just like that without any error messages in the log or a 500 error to the client, but perhaps mediawiki is trapping those errors, or I don't know PHP well enough.

Well, try to get php log enabled or otherwise enable error reporting. I'm guessing it just dies with a fatal php error, possibly because of the reason you guessed.

etherboot wrote:

Ok, will do that next week when I encounter this system again.

etherboot wrote:

Ok, this appears to be a PHP problem. I upgraded to PHP5.2 and it works fine now.

The reason I was at PHP5.1 is because I have to use RHEL5 and the version of PHP supplied is PHP5.1. It took a while for me to locate some suitable PHP5.2 packages to install.

You might want to document somewhere that Mediawiki 1.13.1 requires PHP5.2 now.