Last modified: 2012-05-15 14:26:15 UTC
While trying to get an extension to run I got the following in my apache error logs. The extension worked fine in 1.3.10 [error] PHP Warning: end(): Passed variable is not an array or object in /home/imbeauje/apache/htdocs/wiki/includes/Parser.php on line 425 [error] PHP Warning: end(): Passed variable is not an array or object in /home/imbeauje/apache/htdocs/wiki/includes/Parser.php on line 425 [error] PHP Warning: end(): Passed variable is not an array or object in /home/imbeauje/apache/htdocs/wiki/includes/Parser.php on line 425 [error] PHP Warning: end(): Passed variable is not an array or object in /home/imbeauje/apache/htdocs/wiki/includes/Parser.php on line 425 [error] PHP Notice: Undefined index: html in /home/imbeauje/apache/htdocs/wiki/includes/Parser.php on line 373 [error] PHP Fatal error: Unsupported operand types in /home/imbeauje/apache/htdocs/wiki/includes/Parser.php on line 373 In case it is useful here is my extension: $wgExtensionFunctions[] = "wfTableSchema"; function wfTableSchema() { global $wgParser; $wgParser->setHook( "tableSchema", "renderTableSchema" ); } function renderTableSchema( $input ) { global $wgTitle, $wgParser; $CLASSPATH = "/home/imbeauje/WEBTEAM/HEAD/mrw/Tools/src/:/home/imbeauje/WEBTEAM/HEAD/mrw/Tools/lib/jconn2.jar"; $title = $wgTitle->getDBkey(); //title is of the form database..tableName. Parse to extract list($dbName, $tableName) = explode("..", $title); $dbName = strtolower($dbName); //then pass as params to java prog that will generate table $cmd = "/home/imbeauje/j2sdk1.4.2_06/bin/java -classpath $CLASSPATH ". "com.mizuho.rws.tools.wikiTools.WikiDatabaseTableGenerator $dbName $tableName"; $output = `$cmd`; $output = $wgParser->internalParse($output, 0); return $output; } ?>
I was able to fix my extension by using this instead to parse the wiki text: $output = $wgParser->parse( $output, $wgTitle, $wgOut->mParserOptions, true ); return $output->getText(); Still don't know why my code broke from 1.3.10 to 1.4.0 though.
$wgParser->internalParse is marked as private and is used internaly by the parser. $wgParser->parse is the way to go :)