diff --git a/core/lib/Drupal/Component/Utility/UrlHelper.php b/core/lib/Drupal/Component/Utility/UrlHelper.php index b86eb46..0c0e07d 100644 --- a/core/lib/Drupal/Component/Utility/UrlHelper.php +++ b/core/lib/Drupal/Component/Utility/UrlHelper.php @@ -152,6 +152,7 @@ public static function parse($url) { // Split off everything before the query string into 'path'. $parts = explode('?', $url); + // Don't support URLs without a path, like 'http://'. list(, $path) = explode('://', $parts[0], 2); if ($path != '') { $options['path'] = $parts[0]; diff --git a/core/lib/Drupal/Core/Menu/DefaultMenuLinkTreeManipulators.php b/core/lib/Drupal/Core/Menu/DefaultMenuLinkTreeManipulators.php index f9b6261..ff1792b 100644 --- a/core/lib/Drupal/Core/Menu/DefaultMenuLinkTreeManipulators.php +++ b/core/lib/Drupal/Core/Menu/DefaultMenuLinkTreeManipulators.php @@ -94,7 +94,7 @@ public function checkAccess(array $tree) { * TRUE if the current user can access the link, FALSE otherwise. */ protected function menuLinkCheckAccess(MenuLinkInterface $instance) { - if ($this->account->hasPermission(PathValidator::LINK_PERMISSION)) { + if ($this->account->hasPermission('link to any page')) { return TRUE; } // Use the definition here since that's a lot faster than creating a Url diff --git a/core/lib/Drupal/Core/Path/PathValidator.php b/core/lib/Drupal/Core/Path/PathValidator.php index 540b161..b6c3a5a 100644 --- a/core/lib/Drupal/Core/Path/PathValidator.php +++ b/core/lib/Drupal/Core/Path/PathValidator.php @@ -52,8 +52,6 @@ class PathValidator implements PathValidatorInterface { */ protected $pathProcessor; - const LINK_PERMISSION = 'link to any page'; - /** * Creates a new PathValidator. * @@ -129,7 +127,7 @@ public function getUrlIfValid($path) { * An array of request attributes of FALSE if an exception was thrown. */ protected function getPathAttributes($path, Request $request) { - if ($this->account->hasPermission(static::LINK_PERMISSION)) { + if ($this->account->hasPermission('link to any page')) { $router = $this->accessUnawareRouter; } else { diff --git a/core/modules/link/src/Plugin/Field/FieldWidget/LinkWidget.php b/core/modules/link/src/Plugin/Field/FieldWidget/LinkWidget.php index fbe15b3..acb63e8 100644 --- a/core/modules/link/src/Plugin/Field/FieldWidget/LinkWidget.php +++ b/core/modules/link/src/Plugin/Field/FieldWidget/LinkWidget.php @@ -209,7 +209,7 @@ public function massageFormValues(array $values, array $form, FormStateInterface // Reset the URL value to contain only the path. if (!$url->isExternal() && $this->supportsInternalLinks()) { - $value['url'] = substr($url->toString(), strlen($GLOBALS['base_path'])); + $value['url'] = ltrim($url->toString(), \Drupal::request()->getBaseUrl() . '/'); } } } diff --git a/core/modules/system/system.module b/core/modules/system/system.module index 1ef55cf..c87b768 100644 --- a/core/modules/system/system.module +++ b/core/modules/system/system.module @@ -262,7 +262,8 @@ function system_permission() { 'restrict access' => TRUE, ), 'link to any page' => [ - 'title' => t('This allows to bypass access checking when linking to internal paths.'), + 'title' => t('Link to any page'), + 'description' => t('This allows to bypass access checking when linking to internal paths.'), 'restrict access' => TRUE, ], );