Description
If MockFileSessionStorage
is used and session data are not used (session is not started). Session data are replaced with an empty array.
For example if user is logged in (authentication token is present in the session) and user goes to a non-existenting page, then the session ID is set from cookies (see TestSessionListener#onKernelRequest
) but the session is not started. Then after NotFoundHttpException
is thrown, TestSessionListener#onKernelResponse
calls Session#save
and replaces the session data with an empty array.
In common situations it works becase the session is started when something reads the data from the session. See MockArraySessionStorage#getBag
.
I think there should be some condition if the session is started before it saves it.