diff --git a/core/lib/Drupal/Core/Url.php b/core/lib/Drupal/Core/Url.php index c4779cf9a0..894b700f2b 100644 --- a/core/lib/Drupal/Core/Url.php +++ b/core/lib/Drupal/Core/Url.php @@ -290,7 +290,14 @@ public static function fromUri($uri, $options = []) { $uri_parts['scheme'] = ''; } elseif (empty($uri_parts['scheme'])) { - throw new \InvalidArgumentException("The URI '$uri' is invalid. You must use a valid URI scheme."); + // Workaround for https://github.com/php/php-src/issues/9545. + if (!empty($uri_parts['path']) && str_ends_with($uri_parts['path'], ':')) { + $uri_parts['scheme'] = substr($uri_parts['path'], 0, -1); + unset($uri_parts['path']); + } + else { + throw new \InvalidArgumentException("The URI '$uri' is invalid. You must use a valid URI scheme."); + } } $uri_parts += ['path' => '']; // Discard empty fragment in $options for consistency with parse_url().