diff --git a/core/lib/Drupal/Core/Routing/UrlGenerator.php b/core/lib/Drupal/Core/Routing/UrlGenerator.php index 5a58722..6bc12b0 100644 --- a/core/lib/Drupal/Core/Routing/UrlGenerator.php +++ b/core/lib/Drupal/Core/Routing/UrlGenerator.php @@ -75,17 +75,15 @@ class UrlGenerator implements UrlGeneratorInterface { * @param \Symfony\Component\HttpFoundation\RequestStack $request_stack * A request stack object. * @param string[] $filter_protocols - * An array of protocols allowed for URL generation. + * (optional) An array of protocols allowed for URL generation. */ - public function __construct(RouteProviderInterface $provider, OutboundPathProcessorInterface $path_processor, OutboundRouteProcessorInterface $route_processor, RequestStack $request_stack, $filter_protocols) { + public function __construct(RouteProviderInterface $provider, OutboundPathProcessorInterface $path_processor, OutboundRouteProcessorInterface $route_processor, RequestStack $request_stack, array $filter_protocols = ['http', 'https']) { $this->provider = $provider; $this->context = new RequestContext(); $this->pathProcessor = $path_processor; $this->routeProcessor = $route_processor; - // Ensure to have a safe fallback. This is also needed for some tests, which - // don't specify the filter protocols container parameter. - UrlHelper::setAllowedProtocols($filter_protocols ?: ['http', 'https']); + UrlHelper::setAllowedProtocols($filter_protocols); $this->requestStack = $request_stack; } diff --git a/core/lib/Drupal/Core/Utility/UnroutedUrlAssembler.php b/core/lib/Drupal/Core/Utility/UnroutedUrlAssembler.php index b9e729a..1e807b3 100644 --- a/core/lib/Drupal/Core/Utility/UnroutedUrlAssembler.php +++ b/core/lib/Drupal/Core/Utility/UnroutedUrlAssembler.php @@ -43,12 +43,10 @@ class UnroutedUrlAssembler implements UnroutedUrlAssemblerInterface { * @param \Drupal\Core\PathProcessor\OutboundPathProcessorInterface $path_processor * The output path processor. * @param string[] $filter_protocols - * An array of protocols allowed for URL generation. + * (optional) An array of protocols allowed for URL generation. */ - public function __construct(RequestStack $request_stack, OutboundPathProcessorInterface $path_processor, $filter_protocols = []) { - // Ensure to have a safe fallback. This is also needed for some tests, which - // don't specify the filter protocols container parameter. - UrlHelper::setAllowedProtocols($filter_protocols ?: ['http', 'https']); + public function __construct(RequestStack $request_stack, OutboundPathProcessorInterface $path_processor, array $filter_protocols = ['http', 'https']) { + UrlHelper::setAllowedProtocols($filter_protocols); $this->requestStack = $request_stack; $this->pathProcessor = $path_processor; }