Closed (fixed)
Project:
Drupal core
Version:
8.0.x-dev
Component:
base system
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
3 Sep 2014 at 07:10 UTC
Updated:
26 Jan 2015 at 17:04 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
damiankloip commentedComment #2
larowlanComment #3
dawehnerFor now we can at least extract the initialization of cookies.
Comment #5
dawehnerAdapting the title due to #2331909: Move DrupalKernel::initializeCookieGlobals() into page cache kernel decorator and #2331913: Move DrupalKernel::preHandle code into kernel decorator
Comment #6
dawehnerSo, this time it is green.
Comment #9
damiankloip commentedNice, that works for me. However, i think that is a dependency of clean separation of the handlePageCache removal. So I vote we do this...
EDIT: this does not handle the removal of DRUPAL_BOOTSTRAP_PAGE_CACHE and friends yet.
Comment #11
dawehner<3
Can we at least inject Settings for now?
Are these old methods used in multiple places?
Did you considered to just do a return $response ? This should go back to index.php, call the same methods and so be safe.
Comment #13
znerol commentedWe cannot eliminate this in Drupal 8, the symfony Session object has no substitute for generating a site-specific session_name.
That said I propose to move the logic into a separate service where we also can add useful methods like
hasSessionCookie($request).Related: #1934730: Alternative session handler implementation is not able to override session_name()
Comment #14
dawehner@znerol: Did you considered to create an issue upstream?
Let's just also drop support for page caching in the legacy bootstrap.
Comment #16
dawehnerMeh, this seems to be a problem with
run-tests.shComment #17
znerol commentedI do not think that this is something which belongs into a framework. It seems to me that the session-cookie name falls into the app-domain, or even the site-configuration. In addition I suspect that Drupal does too much work here, for example I do not see any reason why the session-name is recomputed on every request.
From what I gather from the git-history and the issue queue the case for automatically generating the session-cookie name is mere convenience with a moderate security/privacy touch (mixed mode SSL was later added to the mix). The first version of this code was introduced with #56357: Login issues with multiple sites in the same domain (session cookie collision).
However, it seems to me that the session cookie name also could be just generated at install-time and then written to
settings.php(or perhaps into a container parameter which is passed directly toSessionManager/NativeSessionStorage$options.For the record, I've checked some Symfony sites/blogs and many simply use the default
PHPSESSIDcookie name.Comment #18
dawehnerLet's try.
Comment #20
znerol commentedReroll after #2263981: Introduce a robust and extensible page cache-policy framework. Also remove
handlePageCache()fromhttp.phpandhttps.php.Comment #21
znerol commentedComment #22
dawehnerThank you for your reroll. Do you think the interdiff in #18 looks sane?
Comment #23
znerol commentedThis patch accidentally removed every invocation of
DrupalKernel::getContainer()and therefore the container was not dumped anymore.The
Drupal\views_ui\Tests\DisplayPathTestfails to callWebTestBase::resetAll()after installing themenu_ui. Therefore maybe that module is not active in the simpletest child-site? That would mean that the assertions there are not asserting the right thing though.Re #22: I do not have an opinion yet, I'm trying to figure out the test failures first.
Comment #24
znerol commentedFiled #2342807: DisplayPathTest methods enable menu_ui module when it is already enabled on views.
Comment #26
dawehnerI really like it! Anyone else want to RTBC it?
Just curious: do you remove that bootstrap phase somewhere else already? Maybe in the page cache => HTTP Cache issue itself? It feels like dropping it here would be the right place.
Comment #27
znerol commentedRe #18/#22: This looks like a perfect opportunity to actually decouple the
session_nameof the simpletest child site from the one the parent site uses.Comment #29
znerol commentedThe test failures in the installer and in authorize.php pinpoint the actual problem: Requests will not go through stack middleware when something is using
prepareLegacyRequest()instead ofhandle().This is great if the page cache is a stack middleware, it is not so great for the session cookie initialization. In order to resolve that it would be possible to introduce a new event (e.g.
DrupalKernel\KernelEvents::LEGACY_REQUEST) and add request subscribers also there if necessary. Still this would result in very odd parallelism for cookie initialization because we'd end up with a stack middleware (for real requests) and a legacy request subscriber (for the installer / authorize.php).Another possibility would be to introduce an event which replaces
DrupalKernel::preHandle. That event would be fired from withinDrupalKernel::handle()but also from withinDrupalKernel::prepareLegacyRequest. Being executed before the page cache, this would roughly correspond to D7hook_boot.I'm in favor of option 2. Opinions?
Comment #30
znerol commentedInvestigated Option 2, this would have the following consequences:
handle()andprepareLegacyRequest()Regrettably this does not resolve the "odd parallelism" problem described in #29.
Comment #31
Crell commentedMiddlewares are in the Container, so inject this. Don't ever use \Drupal inside a class that's registered in the container.
This doesn't need to be static. There's only a single instance of this class created anyway, so an object property is sufficient.
znerol, I'm a bit unclear on the problem you describe. But an answer of "add moar events" sounds very much like we're asking the wrong question. What exactly is "legacy request", and why does it even exist?
Comment #32
grendzy commentedIs this issue title a typo? AFAIK there has never been a method called initializeCookiesIntoGlobal.
Comment #33
znerol commentedyes
Comment #34
znerol commentedFiled #2347877: Move DrupalKernel::initializeCookieGlobals() into a SessionConfiguration service as an alternative approach.
Comment #35
joelpittet@znerol or @damiankloip is this needed considering the other approach was committed #2347877: Move DrupalKernel::initializeCookieGlobals() into a SessionConfiguration service? Can we close this?
Comment #36
dawehnerYeah we can.