Problem/Motivation

#2303673: Implement stackphp; cleanup handlePageCache() and preHandle() Moved the preHandle() call into a stackphp decorator/middleware. This does what is least invasive for that issue as this can be refactored easily after.

Proposed resolution

Move pre handle code into the decorator, remove code from DrupalKernel and call from decorator to DrupalKernel.

Remaining tasks

User interface changes

None

API changes

None

CommentFileSizeAuthor
#3 2331913.patch20.51 KBdamiankloip

Comments

larowlan’s picture

Status: Postponed » Active
damiankloip’s picture

Assigned: Unassigned » damiankloip

Patch shortly

damiankloip’s picture

Assigned: damiankloip » Unassigned
Status: Active » Needs review
StatusFileSize
new20.51 KB

So here is a start. I added a trait for the initialize methods. As pre handle and handle page cache both tangle usage of the same methods. Still needs work but let's see how this gets on anyway.

Status: Needs review » Needs work

The last submitted patch, 3: 2331913.patch, failed testing.

dawehner’s picture

  1. +++ b/core/lib/Drupal/Core/StackMiddleware/KernelInitializeTrait.php
    @@ -0,0 +1,172 @@
    +  protected function initializeRequestGlobals(Request $request) {
    

    See below, but this can then be moved to the Prehandle wrapper all.

  2. +++ b/core/lib/Drupal/Core/StackMiddleware/KernelInitializeTrait.php
    @@ -0,0 +1,172 @@
    +  /**
    +   * Initialize cookie settings.
    +   *
    +   * @param \Symfony\Component\HttpFoundation\Request $request
    +   *   The current request.
    +   *
    +   * @todo D8: Eliminate this entirely in favor of a session object.
    +   */
    +  protected function initializeCookieGlobals(Request $request) {
    

    Note: I accidentally also worked on #2331909: Move DrupalKernel::initializeCookieGlobals() into page cache kernel decorator which seems to make sense here. Extract the cookie bit out and replace it with some proper session bit. Later we can easily just remove that new class and be done.

Status: Needs work » Needs review

dawehner queued 3: 2331913.patch for re-testing.

Status: Needs review » Needs work

The last submitted patch, 3: 2331913.patch, failed testing.

damiankloip’s picture

Status: Needs work » Postponed

Let's postpone this on #2331909: Move DrupalKernel::initializeCookieGlobals() into page cache kernel decorator for now. We could do with that cookie stack middleware.

damiankloip’s picture

Status: Postponed » Active

Version: 8.0.x-dev » 8.1.x-dev

Drupal 8.0.6 was released on April 6 and is the final bugfix release for the Drupal 8.0.x series. Drupal 8.0.x will not receive any further development aside from security fixes. Drupal 8.1.0-rc1 is now available and sites should prepare to update to 8.1.0.

Bug reports should be targeted against the 8.1.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.1.x-dev » 8.2.x-dev

Drupal 8.1.9 was released on September 7 and is the final bugfix release for the Drupal 8.1.x series. Drupal 8.1.x will not receive any further development aside from security fixes. Drupal 8.2.0-rc1 is now available and sites should prepare to upgrade to 8.2.0.

Bug reports should be targeted against the 8.2.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.6 was released on February 1, 2017 and is the final full bugfix release for the Drupal 8.2.x series. Drupal 8.2.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.3.0 on April 5, 2017. (Drupal 8.3.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.3.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.6 was released on August 2, 2017 and is the final full bugfix release for the Drupal 8.3.x series. Drupal 8.3.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.4.0 on October 4, 2017. (Drupal 8.4.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.4.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.4 was released on January 3, 2018 and is the final full bugfix release for the Drupal 8.4.x series. Drupal 8.4.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.5.0 on March 7, 2018. (Drupal 8.5.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.5.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.6 was released on August 1, 2018 and is the final bugfix release for the Drupal 8.5.x series. Drupal 8.5.x will not receive any further development aside from security fixes. Sites should prepare to update to 8.6.0 on September 5, 2018. (Drupal 8.6.0-rc1 is available for testing.)

Bug reports should be targeted against the 8.6.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.6.x-dev » 8.8.x-dev

Drupal 8.6.x will not receive any further development aside from security fixes. Bug reports should be targeted against the 8.8.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.9.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.7 was released on June 3, 2020 and is the final full bugfix release for the Drupal 8.8.x series. Drupal 8.8.x will not receive any further development aside from security fixes. Sites should prepare to update to Drupal 8.9.0 or Drupal 9.0.0 for ongoing support.

Bug reports should be targeted against the 8.9.x-dev branch from now on, and new development or disruptive changes should be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

andypost’s picture

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.0-rc1 was released on November 26, 2021, which means new developments and disruptive changes should now be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

andypost’s picture

Status: Active » Needs work
+++ b/core/lib/Drupal/Core/DrupalKernelInterface.php
@@ -107,13 +107,4 @@ public function handlePageCache(Request $request);
-   * Helper method that does request related initialization.
-   *
-   * @param \Symfony\Component\HttpFoundation\Request $request
-   *   The current request.
-   */
-  public function preHandle(Request $request);

First it needs to be set @internal or even @deprecated

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

andypost’s picture

Version: 9.5.x-dev » 10.1.x-dev
Issue tags: +Performance

Closed as duplicate #2430201: Do not invoke <code>DrupalKernel::preHandle</code> in subrequests

For performance POV it makes sense to skip preHandle() for subrequests but now it running RequestSanitizer on every request because of SA-CORE-2018-002

Version: 10.1.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch, which currently accepts only minor-version allowed changes. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

andypost’s picture

Issue tags: +Needs reroll

Version: 11.x-dev » main

Drupal core is now using the main branch as the primary development branch. New developments and disruptive changes should now be targeted to the main branch.

Read more in the announcement.