Page MenuHomePhabricator

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

Description

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 created this task.Dec 12 2014, 8:48 PM
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.
aaron added a subscriber: aaron.Dec 12 2014, 9:19 PM

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

https://gerrit.wikimedia.org/r/179575

Patch-For-Review

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

https://gerrit.wikimedia.org/r/179575

Umherirrender closed this task as Resolved.Dec 23 2014, 7:16 PM
Umherirrender claimed this task.
bd808 claimed this task.Dec 23 2014, 7:20 PM
bd808 triaged this task as Normal priority.
bd808 removed a project: Patch-For-Review.
bd808 moved this task from Backlog to Done on the MediaWiki-Core-Team board.
bd808 moved this task from Done to Archive on the MediaWiki-Core-Team board.Dec 29 2014, 10:07 PM
Restricted Application added a project: User-bd808. · View Herald TranscriptApr 12 2016, 3:02 PM

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.

Tgr added a comment.Apr 12 2016, 3:48 PM

Fix is in https://gerrit.wikimedia.org/r/#/c/282953/. Apparently gerritbot does not like closed tasks.

bd808 moved this task from To Do to Done on the User-bd808 board.Apr 13 2016, 4:09 PM
bd808 moved this task from Done to Archive on the User-bd808 board.