By dawehner on
Change record status:
Published (View all published change records)
Project:
Introduced in branch:
8.0.x
Introduced in version:
8.0.0-beta8
Issue links:
Description:
The global $script_path variable is removed. This variable was introduced during the 8.0.x development cycle and did not exist in Drupal 7.
In case you construct something like an URL, previous code probably did something like:
base_path() . $GLOBALS['script_path'] . '/test';
For these usecase you can use
$request->getBaseUrl() . '/test';
For other more specific usecases the following snippet works as well:
$base_path_with_script = $request->getBaseUrl();
if (!empty($base_path_with_script)) {
$script_name = $request->getScriptName();
if (strpos($base_path_with_script, $script_name) !== FALSE) {
$current_script_path = ltrim(substr($script_name, strlen($current_base_path)), '/') . '/';
}
}
Impacts:
Module developers