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).