I'm working through the errors I'm getting with the latest version of the StableVersion extension from Subversion, I'm sorted a couple but have lost the plot with this one:-
Object of class ParserOutput could not be converted to string in *\includes\Parser.php* on line *2779*
Line 2779 is :
function replaceVariables( $text, $args = array(), $argsOnly = false ) { # Prevent too big inclusions 2779: if( strlen( $text ) > $this->mOptions->getMaxIncludeSize() ) { return $text; }
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 ); $this->fixNoWiki( $stripState ); $p->mStripState = $stripState; $text = $p->unstrip( $text, $p->mStripState ); $text = $p->unstripNoWiki( $text, $p->mStripState ); return $text;
Any suggestions would be appreciated.
Thanks
John
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
Lane, Ryan wrote:
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;
Tried running with the changes both with & without the
$p->mOptions = $parserOptions;
but still getting the same error.
Ta
John
Edited getCacheText:-
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; $p->mOptions = $parserOptions; $text = $p->replaceVariables( $text );
$this->fixNoWiki( $stripState ); $p->mStripState = $stripState; $text = $p->unstrip( $text, $p->mStripState ); $text = $p->unstripNoWiki( $text, $p->mStripState );
return $text;
V/r,
Ryan Lane
MediaWiki-l mailing list MediaWiki-l@lists.wikimedia.org http://lists.wikimedia.org/mailman/listinfo/mediawiki-l
Ryan I'm still worrying away at this, with no much success, as a thought could you confirm which versiosn of PHP & MediaWiki you are running on the wiki that it works for you, as well as which version of the extension out of the subversion, my next try is going to be to get it working on those and then see if I can solve it from there.
In 1.9.1 the system works in as far as pages that have a stable version set it is the stable version that is shown, but you can't change the state of the page.
Ta
John
Lane, Ryan wrote:
V/r,
Ryan Lane
MediaWiki-l mailing list MediaWiki-l@lists.wikimedia.org http://lists.wikimedia.org/mailman/listinfo/mediawiki-l
On my test system at home I have MediaWiki 1.6.9 and php 4.3.9. I believe I am using revision 15862 of StableVersion.php.
I added all the necessary hooks to MediaWiki 1.6.9 to get it working.
-----Original Message----- From: mediawiki-l-bounces@lists.wikimedia.org [mailto:mediawiki-l-bounces@lists.wikimedia.org] On Behalf Of John Moorhouse Sent: Sunday, February 04, 2007 5:43 AM To: MediaWiki announcements and site admin list Subject: Re: [Mediawiki-l] StableVersions bugs
Ryan I'm still worrying away at this, with no much success, as a thought could you confirm which versiosn of PHP & MediaWiki you are running on the wiki that it works for you, as well as which version of the extension out of the subversion, my next try is going to be to get it working on those and then see if I can solve it from there.
In 1.9.1 the system works in as far as pages that have a stable version set it is the stable version that is shown, but you can't change the state of the page.
Ta
John
Lane, Ryan wrote:
On my test system at home I have MediaWiki 1.6.9 and php 4.3.9. I believe I am using revision 15862 of StableVersion.php.
I added all the necessary hooks to MediaWiki 1.6.9 to get it working.
Thanks Ryan will give this a go, but as you might see from my other posts I also have it working on 1.9.1 / PHP 5.2.0, thanks for your various suggestions. Ta
John
-----Original Message----- From: mediawiki-l-bounces@lists.wikimedia.org [mailto:mediawiki-l-bounces@lists.wikimedia.org] On Behalf Of John Moorhouse Sent: Sunday, February 04, 2007 5:43 AM To: MediaWiki announcements and site admin list Subject: Re: [Mediawiki-l] StableVersions bugs
Ryan I'm still worrying away at this, with no much success, as a thought could you confirm which versiosn of PHP & MediaWiki you are running on the wiki that it works for you, as well as which version of the extension out of the subversion, my next try is going to be to get it working on those and then see if I can solve it from there.
In 1.9.1 the system works in as far as pages that have a stable version set it is the stable version that is shown, but you can't change the state of the page.
Ta
John
MediaWiki-l mailing list MediaWiki-l@lists.wikimedia.org http://lists.wikimedia.org/mailman/listinfo/mediawiki-l
mediawiki-l@lists.wikimedia.org