Closed (fixed)
Project:
Drupal core
Version:
10.3.x-dev
Component:
base system
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
8 Feb 2024 at 18:41 UTC
Updated:
14 Mar 2024 at 12:59 UTC
Jump to comment: Most recent
In #3392616-5: Update to Symfony 6.4 we've found out that the Symfony\Component\DependencyInjection\ContainerAwareTrait and Symfony\Component\DependencyInjection\ContainerAwareInterface are being deprecated in Symfony 6.4 and removed in 7.0.
Drupal\Core\StackMiddleware\Session is container aware because of the following comment:
* Note, the session service is not injected into this class in order to prevent
* premature initialization of session storage (database). Instead the session
* service is retrieved from the container only when handling the request.
Wrap the session service in a closure to ensure it is only instantiated when necessary.
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #4
longwaveComment #5
longwaveWe can't use
!service_closuresyntax in services.yml because the YAML parser does not support it: #3108309: Support Yaml::PARSE_CUSTOM_TAGS in \Drupal\Component\Serialization\YamlSymfony::decodeHowever we can enable autowiring instead and use the
#[AutowireServiceClosure]attribute.Unsure of the BC implications here especially as
session_managerisbackend_overridable.Comment #6
longwaveFunctional tests are not very happy.
Comment #7
longwavesession_handlerneeds to be explicitly autowired.Comment #8
longwaveNot sure I'm taking the right approach here. Maybe we just inject a session closure directly into the session middleware?
Comment #12
longwaveThis simpler approach seems to work. Unsure if this needs BC - are middleware services part of the API?
Comment #13
longwaveComment #14
longwaveComment #15
catchI'd put them in the same bracket as event subscribers and tagged services (and hook implementations) - so @internal.
Comment #16
spokjeWe might want to documen that here: https://www.drupal.org/about/core/policies/core-change-policies/bc-policy
If we do treat it like
@internal, I would say this is RTBC.Comment #17
catchSince it's just adding another concrete example to an e.g., made the edit: https://www.drupal.org/about/core/policies/core-change-policies/bc-polic...
Comment #18
spokjeThanks @catch
_hats were tipped_
Comment #21
catchThe service closure usage is nice and will help with issues like #3419693: Log error instead of trigger_error in Drupal\Core\EventSubscriber\RedirectResponseSubscriber::checkRedirectUrl, and maybe removing our own lazy/proxy services stuff too.
Committed/pushed to 11.x and cherry-picked to 10.3.x, thanks!