Last modified: 2010-05-15 16:03:00 UTC
PHP: 5.2.4 MySQL: 5.0.45 Given the following extension, I keep getting a blank page if I uncomment either of the commented lines: $wgHooks['EditPage::showEditForm:initial'][] = "wfParserTest"; function wfParserTest( &$editPage ) { global $wgParser; $localParser = new Parser(); //$output = $wgParser->parse( '', $this->mTitle ); //$output = $localParser->parse( '', $this->mTitle ); return true; } This problem occurs if is just try to preprocess any wikitext [using Preprocessor_DOM::preprocessToObj()].
(In reply to comment #0) > PHP: 5.2.4 > MySQL: 5.0.45 > > Given the following extension, I keep getting a blank page if I uncomment > either of the commented lines: Of course you do, because: > //$output = $wgParser->parse( '', $this->mTitle ); > //$output = $localParser->parse( '', $this->mTitle ); you can't use $this inside a global function.
Ah, yes. I'm always amazed by my ability to overlook the obvious. Nonetheless, if I substitute $this->mTitle with a valid title object whose page exists, such as: $wgHooks['EditPage::showEditForm:initial'][] = "wfParserTest"; function wfParserTest( &$editPage ) { global $wgParser; $output = $wgParser->parse( '', Title::newFromText( 'Main Page' ) ); return true; } I still get a blank page when I follow any page's "edit" link.
This is a bug with your code. Bugzilla is not a support forum. Please request help on one of the support forums such as the IRC channel (#mediawiki) or mailing list (mediawiki-l). Hint: $wgParser->parse( $text, $title, new ParserOptions );
My mistake. When I found that a simple method call such as $wgParser->preprocessToDom( '' ); resulted in a blank page, I genuinely though it was a bug. I'll direct my problem to the proper forums.