Page MenuHomePhabricator

$_SESSION['wsCollection'] doesn't always exist in Collection::wfAjaxCollectionGetItemList
Closed, DuplicatePublicPRODUCTION ERROR

Description

Undefined index: wsCollection in /srv/mediawiki/php-1.28.0-wmf.15/extensions/Collection/Collection.php on line 348

There is currently no code to handle the odd case session disappeared between the request and the xhr call:

Collection.php
function wfAjaxCollectionGetItemList() {
	$collection = $_SESSION['wsCollection'];

        ...
}

Event Timeline

Adding a

session_start();

at the top and setting the $_SESSION variable should solve this problem.

@wassan.anmol117 The issue is the wsCollection key doesn't exist in the existing $_SESSION array here.

This is the meaning of "Undefined index" (the index is the array key).

When you doesn't have the array defined, you've this error instead:

$ psysh
>>> $_SESSION['foo'];
PHP error:  Undefined variable: _SESSION on line 1

So, if we add a code that handles this exception, would it solve the problem? Or is there any other way to do it?

It would solve the fact the error is thrown but I fear this is a problem
for a lost session and how we need to recover from there.

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