Object of class ParserOutput could not be converted to string in *\includes\Parser.php* on line *2779*
Line 2779 is :
Let's add the comments for the function back in...
/** * Replace magic variables, templates, and template arguments * with the appropriate text. Templates are substituted recursively, * taking care to avoid infinite loops. * * Note that the substitution depends on value of $mOutputType: * OT_WIKI: only {{subst:}} templates * OT_MSG: only magic variables * OT_HTML: all templates and magic variables * * @param string $tex The text to transform * @param array $args Key-value pairs representing template parameters to substitute * @param bool $argsOnly Only do argument (triple-brace) expansion, not double-brace expansion * @private */
function replaceVariables( $text, $args = array(),
$argsOnly = false ) { # Prevent too big inclusions 2779: if( strlen( $text ) > $this->mOptions->getMaxIncludeSize() ) { return $text; }
Look at the arguments: $text, $args = array(), $argsOnly = false
And this (line 387) is only one place in in the StableVersions.php that calls replaceVariables()
function getCacheText( &$article ) { global $wgStableVersionCaching, $wgUser; $title = $article->getTitle(); $article->loadContent( true ); # FIXME: Do we need the "true" here? For what? Safe redirects?? $text = $article->mContent; $p = new Parser(); $p->disableCache(); $wgStableVersionCaching = true; $parserOptions = ParserOptions::newFromUser( $wgUser ); # Dummy
$text = $p->parse( $text, $title, $parserOptions ); $stripState = $p->mStripState; $wgStableVersionCaching = false;
387 $text = $p->replaceVariables( $text, $parserOptions );
And look at what is being sent, an object. This doesn't look correct at all. Try calling replaceVariables without $parserOptions. If you need to set the parserOptions, try setting it ahead of time by doing:
$p->mOptions = $parserOptions;
V/r,
Ryan Lane