SessionManager: Change behavior of getSessionById()
authorBrad Jorsch <bjorsch@wikimedia.org>
Wed, 20 Jan 2016 17:40:04 +0000 (12:40 -0500)
committerBrad Jorsch <bjorsch@wikimedia.org>
Wed, 20 Jan 2016 17:45:26 +0000 (12:45 -0500)
commit4f5057b84b36eccd16627a6b29831dfdb4483b02
tree958cc7bc31b796299e164d809ec33635c92b278f
parent3dcf440a82a5af6fe1d1a46752b50abb77e500d8
SessionManager: Change behavior of getSessionById()

It's easily possible for SessionManager::getSessionById() to not be
able to load the specified session and to not be able to create an empty
one by that ID, for example if the user's token changed. So change this
from an exceptional condition to an expected one, and adjust callers to
deal with it appropriately.

Let's also make the checks for invalid data structure when loading the
session from the store delete the bogus data entirely.

At the same time, let's change the silly "$noEmpty" parameter to
"$create" and make the default behavior be not to create an empty
session.

Bug: T124126
Change-Id: I085d2026d1b366b1af9fd0e8ca3d815fd8288030
includes/WebRequest.php
includes/context/RequestContext.php
includes/jobqueue/jobs/UploadFromUrlJob.php
includes/session/PHPSessionHandler.php
includes/session/SessionManager.php
includes/session/SessionManagerInterface.php
tests/phpunit/includes/session/PHPSessionHandlerTest.php
tests/phpunit/includes/session/SessionManagerTest.php