diff -u b/core/lib/Drupal/Component/Utility/UrlHelper.php b/core/lib/Drupal/Component/Utility/UrlHelper.php --- b/core/lib/Drupal/Component/Utility/UrlHelper.php +++ b/core/lib/Drupal/Component/Utility/UrlHelper.php @@ -3,6 +3,8 @@ namespace Drupal\Component\Utility; use Symfony\Component\Validator\Constraints\Url; +use Symfony\Component\Validator\Constraints\NotBlank; +use Symfony\Component\Validator\Constraints\NotBlankValidator; use Symfony\Component\Validator\Validation; /** @@ -398,6 +400,7 @@ if ($absolute) { $violations = Validation::createValidator()->validate($url, [ new Url(['protocols' => ['http', 'https', 'ftp', 'feed']]), + new NotBlank(), ]); return !(bool) count($violations); } diff -u b/core/tests/Drupal/Tests/Component/Utility/UrlHelperTest.php b/core/tests/Drupal/Tests/Component/Utility/UrlHelperTest.php --- b/core/tests/Drupal/Tests/Component/Utility/UrlHelperTest.php +++ b/core/tests/Drupal/Tests/Component/Utility/UrlHelperTest.php @@ -223,6 +223,7 @@ ['foo.bar/', 'ftps'], ['foo.com', ''], ['test', ''], + ['', ''], ]; return array_merge($schemes, $this->dataEnhanceWithScheme($data)); }