Page MenuHomePhabricator

Pass-by-reference arguments not passed by reference through StubObject::_call()
Closed, ResolvedPublic


Warning: Parameter 1 to Language::findVariantLink() expected to be a reference, value given in /srv/mediawiki/php-1.25wmf11/includes/StubObject.php on line 105
Warning: Parameter 2 to Language::findVariantLink() expected to be a reference, value given in /srv/mediawiki/php-1.25wmf11/includes/StubObject.php on line 105
public function findVariantLink( &$link, &$nt, $ignoreOtherCond = false ) {

When $wgLang or $wgContLang is a StubObject, StubObject::__call() will intercept the method call and then delegate to StubObject::_call() to unstub the global and dispatch the call to it. This double indirection (and maybe any indirection?) breaks the ability of HHVM to determine that the arguments passed from the original caller's scope should be references rather than values.

Event Timeline

bd808 raised the priority of this task from to Needs Triage.
bd808 updated the task description. (Show Details)
bd808 changed Security from none to None.
bd808 added a project: Language-Team.
bd808 added a subscriber: bd808.

Either the methods should be changed or the stub class can use a stub subclass that enumerates the methods with pass-by-ref args (see the hacks in Article.php for a similar issue).

Change 179575 had a related patch set uploaded (by BryanDavis):
Add findVariantLink to StubUserLang


Change 179575 merged by jenkins-bot:
Add findVariantLink to StubUserLang

Umherirrender claimed this task.
bd808 triaged this task as Medium priority.
bd808 removed a project: Patch-For-Review.
bd808 moved this task from Backlog to Done on the MediaWiki-Core-Team board.

Note: the solution here was a one off fix for the Language::findVariantLink() method. There is no general solution to this class of problems. Either the stubbed object's method needs to change to not expect pass-by-reference input or an explicit method must be added to StubObject that preserves the expected method signature.

Fix is in Apparently gerritbot does not like closed tasks.

bd808 moved this task from Done to Archive on the User-bd808 board.