Problem/Motivation
Symfony\Component\HttpKernel\HttpKernel::handleRaw()
pushes $request onto the stack andSymfony\Component\HttpKernel\HttpKernel::finishRequest()
pops it.DrupalKernel::preHandle()
also pushes $request onto the stack, but there's no matching pop.- As a result, at the conclusion of a subrequest, the stack still contains the subrequest. One consequence of this is that on a comment permalink page (e.g.,
/comment/1
),drupalSettings.path.currentPath
is 'node/1' instead of 'comment/1'. I don't know if there are other, more important, consequences.
Proposed resolution
Introduce RequestStackWrapper
decorator for request_stack
and pass it to http_kernel.basic
instead of symfovy's one to be able to remove it in additional subscriber StackMiddlewareSubscriber
runnig after KernelDestructionSubscriber
Sum-up in #2613044-85: Requests are pushed onto the request stack twice, popped once
Remaining tasks
Get RTBC and commit
User interface changes
no
API changes
2 new services for core: decorator of request stack and stack clean-up after kernel destroyed