Last modified: 2010-05-15 16:03:07 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T17854, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 15854 - Lazy loading and passing by reference
Lazy loading and passing by reference
Status: RESOLVED FIXED
Product: MediaWiki
Classification: Unclassified
General/Unknown (Other open bugs)
1.13.x
All All
: Normal normal (vote)
: ---
Assigned To: Nobody - You can work on this!
:
: 16505 17407 (view as bug list)
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2008-10-05 17:47 UTC by Ángel González
Modified: 2010-05-15 16:03 UTC (History)
3 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments
StubParser (1.46 KB, patch)
2008-10-05 17:47 UTC, Ángel González
Details

Description Ángel González 2008-10-05 17:47:02 UTC
Created attachment 5390 [details]
StubParser

I have problems in the passing of parameters as value or reference in PHP 5.3, interferring with the lazy loading.
Seems that it is choosing to pass it as value looking at the prototype. But when the object is still a Stub, the protoype is not available and pass-by-value is wrongly chosen.
I see it on the second argument of Parser::parse() but it may also be present on other places.

If you're lucky, you get a Warning at the call_user_func_array() on line 58 of StubObject.php

Else, you can get the obscure: Fatal error: Call to a member function getCacheTime() on a non-object in includes/Article.php on line 3387
($parserOutput was not a parser object because $this->mTitle at line 3383 is passed by value)

If pass-by-reference is specified on the call, it is rightly done, in the example above, it'd be changing it to:
$parserOutput = $wgParser->parse( $text, &$this->mTitle, $popts, true, true, $this->getRevIdFetched() );

So changing all second parameter of $wgParser->parse to be prepended by an ampersand (eg $wgTitle -> &$wgTitle) anywhere $wgParser can be an Stub is a fix. But quite weak.

The other option is to have the prototype available at the stub. I have created a StubParser with a dummy parse() function for that.

Finally, there's another option which is deciding that it's a php bug and complaining to them. After all, Mediawiki is "selected in a new effort by the PHP QA Team to make sure that the project still works with PHP versions to-be-released" so they shouldn't be breaking it ;)
Comment 1 Alexandre Emsenhuber [IAlex] 2008-10-05 19:33:53 UTC
Note: I fixed this issue on 1.14alpha in r38995 (tested in PHP 5.3.0alpha1 and 2).
Comment 2 Ángel González 2008-10-05 20:05:22 UTC
I confirm r38995 is another working fix.
Comment 3 Uwe Schindler 2008-11-30 14:06:46 UTC
*** Bug 16505 has been marked as a duplicate of this bug. ***
Comment 4 Alexandre Emsenhuber [IAlex] 2009-02-11 08:52:54 UTC
*** Bug 17407 has been marked as a duplicate of this bug. ***

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links