diff --git a/CHANGELOG.md b/CHANGELOG.md index 1f4c53f..7869b03 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,14 +10,15 @@ All Notable changes to `League\Uri\Interfaces` will be documented in this file - `UriInterface::getUsername` returns the encoded user component of the URI. - `UriInterface::getPassword` returns the encoded scheme-specific information about how to gain authorization to access the resource. - `Uri\IPv6\Converter` allows expanding and compressing IPv6. -- `Uri\IPv4\Converter::to6to4` allows converting an IPv4 into an IPv6 host using the 6to4 notation. -- `Uri\IPv4\Converter::toIPv4MappedIPv6` allows mapping an IPv4 address into an IPv6 one. +- `Uri\IPv4\Converter::toIPv6Using6to4` allows converting an IPv4 into an IPv6 host using the 6to4 notation. +- `Uri\IPv4\Converter::toIPv6UsingMapping` allows mapping an IPv4 address into an IPv6 one. ### Fixed - Adding Host resolution caching to speed up URI parsing in `UriString` -- `UriString::parseAuthority` accepts `Stringable` object as valid input +- `Uri\UriString::parseAuthority` accepts `Stringable` object as valid input - `Uri\IPv4\Converter::toDecimal` also handles 6to4 and IPv4 mapped address algorithm. +- `Uri\QueryString::extract` and `QueryString::convert` stop parsing too early issue [#146](https://github.com/thephpleague/uri-src/issues/146) ### Deprecated diff --git a/Contracts/QueryInterface.php b/Contracts/QueryInterface.php index 70c2075..fed486e 100644 --- a/Contracts/QueryInterface.php +++ b/Contracts/QueryInterface.php @@ -14,6 +14,7 @@ namespace League\Uri\Contracts; use Countable; +use Deprecated; use Iterator; use IteratorAggregate; use Stringable; @@ -229,15 +230,16 @@ public function withPair(string $key, Stringable|string|int|float|bool|null $val /** * DEPRECATION WARNING! This method will be removed in the next major point release. * - * @deprecated Since version 7.2.0 + * @deprecated Since version 7.3.0 * @codeCoverageIgnore - * @see Modifier::removeQueryPairsByKey() + * @see QueryInterface::withoutPairByKey() * * Returns an instance without the specified keys. * * This method MUST retain the state of the current instance, and return * an instance that contains the modified component */ + #[Deprecated(message:'use League\Uri\Contracts\QueryInterface::withoutPairByKey() instead', since:'league/uri-interfaces:7.3.0')] public function withoutPair(string ...$keys): self; /** diff --git a/IPv4/Converter.php b/IPv4/Converter.php index ffdade8..71c0bb9 100644 --- a/IPv4/Converter.php +++ b/IPv4/Converter.php @@ -130,7 +130,7 @@ public function isIpv4(Stringable|string|null $host): bool && false !== long2ip((int) hexdec($hexParts[0]) * 65536 + (int) hexdec($hexParts[1])); } - public function to6to4(Stringable|string|null $host): ?string + public function toIPv6Using6to4(Stringable|string|null $host): ?string { $host = $this->toDecimal($host); if (null === $host) { @@ -146,14 +146,14 @@ public function to6to4(Stringable|string|null $host): ?string return '['.self::IPV6_6TO4_PREFIX.$parts[0].$parts[1].':'.$parts[2].$parts[3].'::]'; } - public function toIPv4MappedIPv6(Stringable|string|null $host): ?string + public function toIPv6UsingMapping(Stringable|string|null $host): ?string { $host = $this->toDecimal($host); + if (null === $host) { + return null; + } - return match ($host) { - null => null, - default => '['.self::IPV4_MAPPED_PREFIX.$host.']', - }; + return '['.self::IPV4_MAPPED_PREFIX.$host.']'; } public function toOctal(Stringable|string|null $host): ?string diff --git a/IPv4/ConverterTest.php b/IPv4/ConverterTest.php index 81723ad..ffff0a4 100644 --- a/IPv4/ConverterTest.php +++ b/IPv4/ConverterTest.php @@ -47,13 +47,13 @@ public function testConvertToDecimal( self::assertSame($hexadecimal, Converter::fromNative()->toHexadecimal($input)); self::assertSame($hexadecimal, Converter::fromBCMath()->toHexadecimal($input)); - self::assertSame($sixToFour, Converter::fromBCMath()->to6to4($input)); - self::assertSame($sixToFour, Converter::fromNative()->to6to4($input)); - self::assertSame($sixToFour, Converter::fromBCMath()->to6to4($input)); + self::assertSame($sixToFour, Converter::fromBCMath()->toIPv6Using6to4($input)); + self::assertSame($sixToFour, Converter::fromNative()->toIPv6Using6to4($input)); + self::assertSame($sixToFour, Converter::fromBCMath()->toIPv6Using6to4($input)); - self::assertSame($ipv4Mapped, Converter::fromBCMath()->toIPv4MappedIPv6($input)); - self::assertSame($ipv4Mapped, Converter::fromNative()->toIPv4MappedIPv6($input)); - self::assertSame($ipv4Mapped, Converter::fromBCMath()->toIPv4MappedIPv6($input)); + self::assertSame($ipv4Mapped, Converter::fromBCMath()->toIPv6UsingMapping($input)); + self::assertSame($ipv4Mapped, Converter::fromNative()->toIPv6UsingMapping($input)); + self::assertSame($ipv4Mapped, Converter::fromBCMath()->toIPv6UsingMapping($input)); self::assertTrue(Converter::fromEnvironment()->isIpv4($input)); }