Fix domain with statistics

Created on 13 September 2023, about 1 year ago
Updated 20 September 2023, about 1 year ago

Drupal Version

9.5.x

Domain module version

dev-2.0.x

Expected Behavior

When core statistics module is enabled, ajax calls to statistics.php should not cause errors.

Actual Behavior

Core statistics module calling POST to statistics.php raise PHP 500 errors.

Steps to reproduce

Enable statistics module to work on a site running the domains module, while in one of the domains, view a node. In the error consile, an error appears:

The website encountered an unexpected error. Please try again later.
TypeError: Drupal\Core\Routing\CurrentRouteMatch::getRouteMatch(): Argument #1 ($request) must be of type Symfony\Component\HttpFoundation\Request, null given, called in /app/drupal/core/lib/Drupal/Core/Routing/CurrentRouteMatch.php on line 87 in Drupal\Core\Routing\CurrentRouteMatch->getRouteMatch() (line 99 of core/lib/Drupal/Core/Routing/CurrentRouteMatch.php).
Drupal\Core\Routing\CurrentRouteMatch->getRouteMatch(NULL) (Line: 87)
Drupal\Core\Routing\CurrentRouteMatch->getCurrentRouteMatch() (Line: 49)
Drupal\Core\Routing\CurrentRouteMatch->getRouteObject() (Line: 41)
Drupal\Core\Routing\AdminContext->isAdminRoute() (Line: 264)
Drupal\domain_config\DomainConfigOverrider->initiateContext() (Line: 143)
Drupal\domain_config\DomainConfigOverrider->loadOverrides(Array) (Line: 209)
Drupal\Core\Config\ConfigFactory->loadOverrides(Array) (Line: 169)
Drupal\Core\Config\ConfigFactory->doLoadMultiple(Array, 1) (Line: 68)
Drupal\domain_config_ui\Config\ConfigFactory->doLoadMultiple(Array, 1) (Line: 104)
Drupal\Core\Config\ConfigFactory->doGet('statistics.settings', 1) (Line: 109)
Drupal\domain_config_ui\Config\ConfigFactory->doGet('statistics.settings') (Line: 89)
Drupal\Core\Config\ConfigFactory->get('statistics.settings') (Line: 21)

The issue is coming from the statistics.php not initiating the whole stack (see related https://www.drupal.org/project/drupal/issues/2302385 πŸ“Œ Remove custom statistics.php front controller Active )

πŸ› Bug report
Status

Needs work

Version

2.0

Component

Code

Created by

πŸ‡§πŸ‡¬Bulgaria alexrayu

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024