#3631129 DomainSourcePathProcessor treats <current> as the route of the path since Drupal 11.4 (3.0.x backport)

Backport of !477 (merged) (#3631129) to 3.0.x.

On core 11.4 the URL generator passes <current> as the route name, which none of the processor's filters can match. DomainSourcePathProcessor::getRouteName() returns the current route's name for <current>, so the exclusion check and the entity lookup see the real route. On core below 11.4 nothing changes: the generator passes no route name and DomainSourceRouteMatcher still resolves it from the path.

Difference from 4.x and 3.x: the class is not @internal on 3.0.x, so its constructor keeps its signature (identical to 3.0.x). The current route match is read through a small getCurrentRouteMatch() helper calling \Drupal::routeMatch(), with the phpcs GlobalDrupal sniff disabled and the phpstan-drupal globalDrupalDependencyInjection.useDependencyInjection error ignored on that one line.

The test also differs from 4.x: it carries @group domain_source (core 10's test discovery requires it) and overrides register() so that domain_source.route_provider extends the real route provider that kernel tests keep as test.router.route_provider. Before core 11.4 the processor reaches DomainSourceRouteMatcher, whose provider cannot be built from the argument-less provider kernel tests put in place.

Locally: DomainSourceCurrentRouteTest passes on core 11.4 and on Drupal 10.6, and fails without the fix on 11.4 ('/node/1'); phpcs and phpstan clean on the changed files. DomainAliasDomainDeleteTest (a BrowserTestBase class under Kernel/) fails in the local kernel runner on unpatched 3.0.x too (no SIMPLETEST_BASE_URL).

AI-Generated: Yes (Claude Code was used to help backport the fix and its test and to write this description. I reviewed them, and the test was confirmed to fail on 3.0.x without the fix and to pass with it.)

Edited by Frank Mably

Merge request reports

Loading
Loading