Page MenuHomePhabricator

SkinMinerva.php file logs "Undefined variable: returntoquery` error
Closed, ResolvedPublic1 Estimated Story PointsPRODUCTION ERROR

Description

The fatalmonitor shows:

Undefined variable: returntoquery in /srv/mediawiki/php-1.32.0-wmf.23/skins/MinervaNeue/includes/skins/SkinMinerva.php on line 701

error.

Developer notes

The $returntoquery variable is created only when a request wasn't POSTed, but the variable is accessed both on POST and non-POST requests. Please move the $returntoquery variable creation to top of SkinMinerva::insertLogInOutMenuItem() function.

Related Objects

StatusSubtypeAssignedTask
ResolvedReleasezeljkofilipin
ResolvedPRODUCTION ERRORNone

Event Timeline

Change 462749 had a related patch set uploaded (by Pmiazga; owner: Pmiazga):
[mediawiki/skins/MinervaNeue@master] Create $returntoquery variable properly

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

Jdlrobson moved this task from Incoming to Upcoming on the Web-Team-Backlog board.
ovasileva set the point value for this task to 1.Sep 25 2018, 4:19 PM

Presumably, this one is related as well. I'll map it to the same task for now.

PHP Warning: Invalid argument supplied for foreach()

#1 /srv/mediawiki/php-1.32.0-wmf.23/skins/MinervaNeue/includes/skins/SkinMinerva.php(701): wfArrayToCgi(NULL)
#2 /srv/mediawiki/php-1.32.0-wmf.23/skins/MinervaNeue/includes/skins/SkinMinerva.php(543): SkinMinerva->insertLogInOutMenuItem(MediaWiki\Minerva\MenuBuilder)
#3 /srv/mediawiki/php-1.32.0-wmf.23/skins/MinervaNeue/includes/skins/SkinMinerva.php(560): SkinMinerva->buildPersonalTools(MediaWiki\Minerva\MenuBuilder)
# line 701
$query[ 'returntoquery' ] = wfArrayToCgi( $returntoquery );
zeljkofilipin raised the priority of this task from High to Unbreak Now!.Sep 26 2018, 8:10 AM
zeljkofilipin subscribed.

Changing priority to 😱Unbreak Now!🤯 since it's blocking the train!

BTW, I found what's causing this issue, and it's pretty magical, PHP magic. The error was introduced in https://gerrit.wikimedia.org/r/#/c/mediawiki/skins/MinervaNeue/+/461848/

The variable $returntoquery didn't exist in the else{} statement, but because we were setting $returntoquery[ 'welcome' ] = 'yes' PHP magically was creating that variable under the hood. Because we removed setting the welcome key, the variable wasn't defined, and because that it stopped working.

Change 462749 merged by jenkins-bot:
[mediawiki/skins/MinervaNeue@master] Create $returntoquery variable properly

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

Change 463087 had a related patch set uploaded (by Pmiazga; owner: Pmiazga):
[mediawiki/skins/MinervaNeue@wmf/1.32.0-wmf.23] Create $returntoquery variable properly

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

Change 463087 merged by jenkins-bot:
[mediawiki/skins/MinervaNeue@wmf/1.32.0-wmf.23] Create $returntoquery variable properly

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

Mentioned in SAL (#wikimedia-operations) [2018-09-26T15:29:39Z] <pmiazga@deploy1001> Synchronized php-1.32.0-wmf.23/skins/MinervaNeue/includes/skins/SkinMinerva.php: SWAT: [[gerrit:463087|Create $returntoquery variable properly(T205449)]] (duration: 00m 56s)

mmodell changed the subtype of this task from "Task" to "Production Error".Aug 28 2019, 11:07 PM