Fix session accessors

This commit is contained in:
Damian Mooyman 2017-06-12 14:59:20 +12:00
parent 1ab843776d
commit 9ec863f917
No known key found for this signature in database
GPG Key ID: 78B823A10DE27D1A
2 changed files with 3 additions and 4 deletions

View File

@ -86,10 +86,10 @@ class TestSessionEnvironment
public function init(HTTPRequest $request)
{
if (!$this->id) {
$request->getSession()->start();
$request->getSession()->init();
// $_SESSION != Session::get() in some execution paths, suspect Controller->pushCurrent()
// as part of the issue, easiest resolution is to use session directly for now
$this->id = (isset($_SESSION['TestSessionId'])) ? $_SESSION['TestSessionId'] : null;
$this->id = $request->getSession()->get('TestSessionId');
}
}

View File

@ -8,7 +8,6 @@ use SilverStripe\Control\Email\Mailer;
use SilverStripe\Control\HTTPRequest;
use SilverStripe\Control\HTTPResponse;
use SilverStripe\Control\RequestFilter;
use SilverStripe\Control\Session;
use SilverStripe\Core\Injector\Injector;
use SilverStripe\ORM\DB;
use SilverStripe\ORM\FieldType\DBDatetime;
@ -76,7 +75,7 @@ class TestSessionRequestFilter implements RequestFilter
// Store PHP session
$state = $this->testSessionEnvironment->getState();
$state->session = Session::get_all();
$state->session = $request->getSession()->getAll();
$this->testSessionEnvironment->applyState($state);
}
}