Drupal 10.3.x Update Introduces Unconditional Session Object Addition
The latest change in the Drupal 10.3.x branch introduces an unconditional addition of a session object supported by Symfony MockArraySessionStorage to every request in DrupalKernel::preHandle(). This leads to the automatic availability of a session on every request within specific environments, including tests inheriting from KernelTestBase, tests using FunctionalTestSetupTrait::initKernel(), as well as Drush and Drupal console commands. This impact is pertinent to test code and command line utilities, with no alteration to the availability of the session backed by persistent storage in production code.
The deprecations associated with this change warn that pushing requests without a session onto the request_stack is deprecated in Drupal 10.3.0, with an error to be enforced from Drupal 11.0.0 onwards. The comprehensive update is relevant to module developers, distribution developers, and other updates. The documentation in support of this change record remains pending. The author, znerol, highlighted the nuances and impact of the latest Drupal core update.
