From afe442f2966c1a5d3f91a702b168100e4cdd4d15 Mon Sep 17 00:00:00 2001 From: ignace nyamagana butera Date: Sun, 29 Dec 2024 22:29:16 +0100 Subject: [PATCH] Fix URI RFC3986 parsing and invalid characters --- interfaces/CHANGELOG.md | 4 ++-- interfaces/UriString.php | 4 +--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/interfaces/CHANGELOG.md b/interfaces/CHANGELOG.md index 601fda9a..dc9e8207 100644 --- a/interfaces/CHANGELOG.md +++ b/interfaces/CHANGELOG.md @@ -17,8 +17,8 @@ All Notable changes to `League\Uri\Interfaces` will be documented in this file - `League\Uri\IPv6\Converter::isIpv6` - `UriString::resolve` - `UriString::removeDotSegments` -- `UriString::parseAndNormalize` -- `UriString::parseAuthorityAndNormalize` +- `UriString::normalize` +- `UriString::normalizeAuthority` ### Fixed diff --git a/interfaces/UriString.php b/interfaces/UriString.php index 6c33a754..c8c691ea 100644 --- a/interfaces/UriString.php +++ b/interfaces/UriString.php @@ -16,7 +16,6 @@ use League\Uri\Exceptions\ConversionFailed; use League\Uri\Exceptions\MissingFeature; use League\Uri\Exceptions\SyntaxError; -use League\Uri\Idna\Converter; use League\Uri\Idna\Converter as IdnaConverter; use League\Uri\IPv6\Converter as IPv6Converter; use Stringable; @@ -486,7 +485,6 @@ private static function resolvePathAndQuery(array $uri, array $baseUri): array public static function parse(Stringable|string|int $uri): array { $uri = (string) $uri; - if (isset(self::URI_SHORTCUTS[$uri])) { /** @var ComponentMap $components */ $components = [...self::URI_COMPONENTS, ...self::URI_SHORTCUTS[$uri]]; @@ -660,7 +658,7 @@ private static function filterRegisteredName(string $host): void throw new SyntaxError(sprintf('Host `%s` is invalid: the host is not a valid registered name', $host)); } - Converter::toAsciiOrFail($host); + IdnaConverter::toAsciiOrFail($host); } /**