Problem/Motivation
Drupal's PathMatcher::isFrontPage() and the AliasPathMatcher decorator each cache their result in an isCurrentFrontPage property. Neither property is reset between requests.
When FrankenPHP worker mode reuses the kernel and services, subsequent requests receive the cached result from the first request. A cached TRUE incorrectly identifies other routes as the front page. A cached FALSE prevents later front-page requests from matching.
Steps to reproduce
- Start a fresh FrankenPHP worker.
- Request the front page. Front-page detection is cached to TRUE.
- Request
/session/tokenthrough the same worker. - You get redirected to the front page.
Proposed resolution
Remove the $isCurrentFrontPage property from both classes and compute the result on each call.
If the caching needs to be kept, let's try to find a way to do it that won't go stale for new requests.
AI disclosure: I used AI to help prepare the IS and MR (Astra and Opus 5.5).
Issue fork drupal-3626322
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 #3
ptmkenny commentedComment #4
ptmkenny commentedThis issue needs a decision on whether caching is needed and a test.