Page MenuHomePhabricator

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

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.

Event Timeline

pmiazga created this task.Sep 25 2018, 3:50 PM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptSep 25 2018, 3:50 PM

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 triaged this task as High priority.Sep 25 2018, 4:00 PM
Jdlrobson moved this task from Incoming to Upcoming on the Readers-Web-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 added a subscriber: zeljkofilipin.

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

Restricted Application added subscribers: Liuxinyu970226, TerraCodes. · View Herald TranscriptSep 26 2018, 8:10 AM

I'm on it right now

pmiazga added a comment.EditedSep 26 2018, 1:51 PM

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)

Looks like error is gone

pmiazga closed this task as Resolved.Sep 26 2018, 3:50 PM
mmodell changed the subtype of this task from "Task" to "Production Error".Aug 28 2019, 11:07 PM