Closed (fixed)
Project:
Drupal core
Version:
10.3.x-dev
Component:
base system
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
8 Jan 2024 at 11:20 UTC
Updated:
18 Sep 2025 at 11:58 UTC
Jump to comment: Most recent
After #2484991: Add the session to the request in KernelTestBase, BrowserTestBase, and drush a session is now always on the request. Hence, calls to hasSession() should be removed.
Trivial changes do not require any additional modifications (e.g., no changes in tests or other areas of the code base).
core/includes/install.core.inc (trivial)core/lib/Drupal/Core/Entity/EntityDeleteMultipleAccessCheck.php. This one could be replaced by a call to \Drupal::service('session_configuration')->hasSession($request) which might have been the original intention anyway.core/lib/Drupal/Core/StackMiddleware/Session.php (trivial)core/lib/Drupal/Core/TempStore/SharedTempStore.php (trivial)core/lib/Drupal/Core/TempStore/SharedTempStoreFactory.php (trivial)core/lib/Drupal/Core/Update/UpdateKernel.php (trivial)core/lib/Drupal/Core/DrupalKernel.php (trivial). Leave one occurrence in preHandle().core/modules/big_pipe/src/Controller/BigPipeController.php. This one could be replaced by a call to \Drupal::service('session_configuration')->hasSession($request) which might have been the original intention anyway.core/modules/comment/src/Controller/CommentController.php (trivial)core/modules/user/src/Authentication/Provider/Cookie.php (trivial)core/modules/views/src/ViewExecutable.php (trivial)These changes require additional modifications (e.g., changes in tests or other areas of the code base).
core/lib/Drupal/Core/Cache/Context/SessionCacheContext.php. Requires deletion of one Test in core/tests/Drupal/Tests/Core/Cache/Context/SessionCacheContextTest.php.core/lib/Drupal/Core/Form/FormBuilder.php. Requires a fix in core/modules/views_ui/src/ViewUI.php for the views preview functionality. Also requires a fix in core/tests/Drupal/Tests/Core/Form/FormBuilderTest.php.core/lib/Drupal/Core/TempStore/PrivateTempStore.php. This has been dead code in production for a long time. Requires a fix in core/tests/Drupal/KernelTests/Core/TempStore/AnonymousPrivateTempStoreTest.php.This issue requires manual testing. Areas to test:
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 #2
prabuela commented.
Comment #3
andypostComment #4
znerol commentedComment #6
znerol commentedComment #7
daffie commentedAll the code changes look good to me.
Comment #8
znerol commentedComment #9
znerol commentedComment #10
alexpottI think we need to deprecate the startSession method in PrivateTempStore - can an MR be opened against 10.3.x that does this. There are plenty of things that extent PrivateTempStore in contrib and one of them may well be relying on this method - or it may happen in custom code too.
Comment #12
znerol commentedComment #13
smustgrave commentedDeprecation appears correct and points to the CR link.
Comment #14
alexpottCommitted 0d54ea9 and pushed to 11.x. Thanks!
Committed 57ce2e3 and pushed to 10.3.x. Thanks!