Remove DrupalKernel::initializeRequestGlobals and replace base_root, base_url and base_path with a service

Created on 8 July 2015, almost 9 years ago
Updated 28 February 2023, over 1 year ago

Problem/Motivation

The global variables base_url, base_path and base_root as well as the base_path() function are still used throughout core. Removal of those is tricky, since there is no direct replacement on the Symfony request object for those. The globals in Drupal are always relative to the application directory, while Symfony $request->getBaseUrl() returns the base URL relative to the front controller.

For example when running the installer (hxxp://example.com/drupal/core/install.php), Symfony will report the base URL including the core path, while $base_url will only be up to drupal.

Proposed resolution

Since there is no direct replacement in Symfony, it is necessary to introduce an additional service which is capable of returning the base URL and the base path relative to the application (not the front controller).

Remaining tasks

User interface changes

API changes

Data model changes

πŸ“Œ Task
Status

Needs work

Version

10.1 ✨

Component
BaseΒ  β†’

Last updated less than a minute ago

Created by

πŸ‡¨πŸ‡­Switzerland znerol

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.69.0 2024