Problem/Motivation
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.
Steps to reproduce
Proposed resolution
Trivial changes
Trivial changes do not require any additional modifications (e.g., no changes in tests or other areas of the code base).
- Remove 3 occurrences from
core/includes/install.core.inc(trivial) - Remove 1 occurrence from
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. - Remove 1 occurrence from
core/lib/Drupal/Core/StackMiddleware/Session.php(trivial) - Remove 1 occurrence from
core/lib/Drupal/Core/TempStore/SharedTempStore.php(trivial) - Remove 1 occurrence from
core/lib/Drupal/Core/TempStore/SharedTempStoreFactory.php(trivial) - Remove 1 occurrence from
core/lib/Drupal/Core/Update/UpdateKernel.php(trivial) - Remove 2 occurrences from
core/lib/Drupal/Core/DrupalKernel.php(trivial). Leave one occurrence inpreHandle(). - Remove 1 occurrence from
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. - Remove 1 occurrence from
core/modules/comment/src/Controller/CommentController.php(trivial) - Remove 2 occurrences from
core/modules/user/src/Authentication/Provider/Cookie.php(trivial) - Remove 1 occurrence from
core/modules/views/src/ViewExecutable.php(trivial)
Non-trivial changes
These changes require additional modifications (e.g., changes in tests or other areas of the code base).
- Remove 1 occurrence from
core/lib/Drupal/Core/Cache/Context/SessionCacheContext.php. Requires deletion of one Test incore/tests/Drupal/Tests/Core/Cache/Context/SessionCacheContextTest.php. - Remove 1 occurrence from
core/lib/Drupal/Core/Form/FormBuilder.php. Requires a fix incore/modules/views_ui/src/ViewUI.phpfor the views preview functionality. Also requires a fix incore/tests/Drupal/Tests/Core/Form/FormBuilderTest.php. - Remove manual session start code from
core/lib/Drupal/Core/TempStore/PrivateTempStore.php. This has been dead code in production for a long time. Requires a fix incore/tests/Drupal/KernelTests/Core/TempStore/AnonymousPrivateTempStoreTest.php.
Note to reviewers
This issue requires manual testing. Areas to test:
- Installation via the web installer
- Running update.php
- Using views and views previews
- Using the layout builder (private temp store)
- Using big pipe
Remaining tasks
ImplementReview- Manual Testing
User interface changes
API changes
Data model changes
Release notes snippet
Issue fork drupal-3413153
Show commands
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!