Last modified: 2010-05-15 16:03:51 UTC
After I upgraded my PHP to 5.3.0, I've started to get these two errors: Warning: Parameter 2 to Parser::parse() expected to be a reference, value given in /home/site/gzcore/wiki/includes/StubObject.php on line 58 Fatal error: Call to a member function getCacheTime() on a non-object in /home/site/gzcore/wiki/includes/Article.php on line 3387 I've no clue if this version of MW is supposed to work with PHP 5.3.0, but it sure would be nice to get it working. Thanks.
1) From the looks of it, something early on in the process is calling $wgParser while it's still stubbed and trying to run Parser::parse() with invalid arguments. This doesn't appear to have changed in trunk 1.15 either. What extensions are you running? Does disabling them help fix this? 2) This would appear that Parser::parse() is returning a non-ParserOutput return. It's probably related to #1 somehow.
No extensions at all, whatsoever. Yes, I figured it was returning something incorrect, but I really couldn't make out where it went wrong (mostly because I can't find my way in the source ;)).
Downgrading severity, PHP 5.3 is still in alpha and is subject to change.
*** This bug has been marked as a duplicate of bug 16505 ***
Oops, false bug. *** This bug has been marked as a duplicate of bug 15854 ***
The problem indeed lies in the implementation of the StubObject, it doesn't forward the call properly (there are some warnings about references too); the parse () method-call never reaches the Parser class. This is because of a change in the 5.3 codebase: in previous versions PHP would be silent if you'd pass values in call_user_func_array, even if they were declared references (which in theory wouldn't work - there's nothing to reference to). In PHP 5.3 however this throws a warning, and the function call will be aborted. A simple snippet to reproduce this; <?php function test (& $value) { echo 'Hello, world!'; } call_user_func_array ('test', array (5)); ?> In PHP 5.2 this echos "Hello, world!", in PHP 5.3 nothing other than a warning. I'm not familiar with the MediaWiki codebase so I wasn't capable of producing a proper fix, however, disabling the StubObject did solve the problem. A simple patch is included below, doing nothing else than disabling the StubObject for the Parser class. Regards, Peter --------------------------------------------------- includes/Setup.php : 244 - $wgParser = new StubObject( 'wgParser', $wgParserConf['class'], array( $wgParserConf ) ); + $wgParser = new $wgParserConf['class'] ($wgParserConf);
I'll try with that, thanks. What IS the StubObject though? I wasn't able to figure out what it's used for.