Commit b37fc1e
committed
bug #46249 [HttpFoundation] [Session] Regenerate invalid session id (peter17)
This PR was merged into the 4.4 branch.
Discussion
----------
[HttpFoundation] [Session] Regenerate invalid session id
| Q | A
| ------------- | ---
| Branch? | 4.4
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Tickets | Fix #45755
| License | MIT
| Doc PR | no
Currently, having a PHPSESSID which does not match `/^[a-zA-Z0-9,\-]{1,123}$/` (see https://www.php.net/manual/fr/function.session-start.php) will produce a php.WARNING and then a RuntimeException (please read #45755).
I don't think there is a nice way to handle this so I propose to simply ignore invalid values.
With this PR, a value for PHPSESSID that does not match the regex will be ignored and a new session id will be generated. Then, the behavior will be the same as if no session existed, so a new session will be started and a new PHPSESSID will be defined.
It looks like Session storage is currently untested so I don't know how to test this...
Best regards
Commits
-------
d8f84c7 [HttpFoundation] [Session] Overwrite invalid session idFile tree
2 files changed
+15
-0
lines changed- src/Symfony/Component/HttpFoundation
- Session/Storage
- Tests/Session/Storage
2 files changed
+15
-0
lines changedLines changed: 6 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
152 | 152 | | |
153 | 153 | | |
154 | 154 | | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
155 | 161 | | |
156 | 162 | | |
157 | 163 | | |
| |||
Lines changed: 9 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
293 | 293 | | |
294 | 294 | | |
295 | 295 | | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
296 | 305 | | |
0 commit comments