Implement Symfony SessionListener

Created on 31 May 2022, over 2 years ago
Updated 28 December 2023, 11 months ago

Problem/Motivation

Drupal implemented much of Symfony's session handling logic in the D8 cycle in #2229145: Register symfony session components in the DIC and inject the session service into the request object β†’ . However, Symfony's SessionListener was not [separately?] implemented. I can't find any comments specific to this point, but it appears that perhaps this was omitted because Drupal could just as easily add the session manager to the DIC and provide access to session data, there? Regardless, this isn't much of an issue for most users, except:

I come to this issue from the second avenue, but the problem remains the same - PHP's native session handling is a bit janky and incompatible with alternative servers.

Symfony apps that more directly implement the HttpKernel component received updates in 5.4 which convert the session cookie from being set natively by PHP and lifts it into the response object. Drupal can and should stay closer to the Symfony trunk and in doing so receive this compatibility improvement. Daffie's Swoole module more or less include this change in a patched version of SessionManager, but there's no reason we should have to do so there if we could use Symfony's shipped session listener, instead.

That speaks to the response handling of the Symfony SessionListener; the request side sets the session on the request object. Drupal handles this in middleware. However, the Symfony SessionListener does basically the same thing, including saving the session. See https://git.drupalcode.org/project/drupal/-/blob/9018da4a5b181bc0fa3fbe2...

Steps to reproduce

Witness Drupal not being compatible with Swoole/PHP-PM/etc. or weirdness with session handling as described above.

Proposed resolution

Replace Drupal's bespoke Session stack middleware and implement more native compatibility with CLI invocation by implementing Symfony's SessionListener.

Remaining tasks

User interface changes

None

API changes

Session stack middleware removal.

Data model changes

Release notes snippet

πŸ“Œ Task
Status

Active

Version

11.0 πŸ”₯

Component
BaseΒ  β†’

Last updated about 5 hours ago

Created by

πŸ‡ΊπŸ‡ΈUnited States bradjones1 Digital Nomad Life

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024