Session variables are not persisted correctly #54856
Unanswered
egonolieux
asked this question in
Q&A
Replies: 1 comment
-
I guess you’re using the WebProfilerBundle? Your listener would be called when it renders its toolbar, or for every asynchronous request your application would handle. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Symfony version(s) affected
7.0.7
Description
I have an event listener in which I write some data to the session. The data basically contains some information about the last request. However, upon the next request, the data from the session doesn't seem to correspond to the previous request, although no other/intermediate requests were made.
Here is a simplified tested example:
The expected output
Notice that the previous value of request 2/3 aligns with the current value of request 1/2.
The actual output
Notice that the previous value of request 2/3 doesn't align with the current value of request 1/2.
The issue seems to be independent from the way sessions are stored. I was able to reproduce this for both file and database based sessions.
Using the native
$_SESSION
produces the expected output without issues as well, so this seems related to Symfony specifically.How to reproduce
Simply run the code above.
Possible Solution
No response
Additional Context
No response
Beta Was this translation helpful? Give feedback.
All reactions