IBX-1218: Fixed a Symfony\Component\HttpFoundation::getSession() call…#240
IBX-1218: Fixed a Symfony\Component\HttpFoundation::getSession() call…#240McLone wants to merge 1 commit intoezsystems:1.3from
Conversation
… without checking its existence with hasSession()
|
Kudos, SonarCloud Quality Gate passed!
|
|
Hi @McLone! Could you please provide some steps to reproduce this issue? |
|
Hi @adamwojs! I fell on it when I tried to apply a "base functional tests" based on Symfony\Bundle\FrameworkBundle\Test\WebTestCase on a new project based on OSS 3.3. IMHO the problem was obvious enough not to investigate further, but I'll try to provide reproduction steps in, I hope, a not too distant future. |
|
@McLone actually, I've found something similar when I was designing If router / security is not configured, then a lot of services related to session & request contexts do not exist. So that's probably the cause. So technically this comes from incomplete configuration, which might happen in test environment. |
|
Incomplete configuration indeed ! To avoid this in a Symfony\Bundle\FrameworkBundle\Test\WebTestCase context, you just have to set 'SCRIPT_FILENAME' => 'app.php' in the "server" param of WebTestCase::createClient(). @adamwojs As ezplatform-kernel do not use WebTestCase for its tests, it would be hard for me to provide you with a simple and clean detailed reproduction procedure. Sorry :( |








… without checking its existence with hasSession()
v3.3This PR fix a thrown exception (\Symfony\Component\HttpFoundation\Exception\SessionNotFoundException) if no session is available in the request.
Checklist:
$ composer fix-cs).@ezsystems/engineering-team).