Skip to content

Commit aefea5b

Browse files
committed
Bug fix #133
1 parent 521e5ed commit aefea5b

File tree

3 files changed

+49
-1
lines changed

3 files changed

+49
-1
lines changed

components/CHANGELOG.md

+19
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,25 @@
22

33
All Notable changes to `League\Uri\Components` will be documented in this file
44

5+
## [Next](https://github.com/thephpleague/uri-components/compare/7.4.0...master) - TBD
6+
7+
### Added
8+
9+
- None
10+
11+
### Fixed
12+
13+
- Fix package to avoid PHP8.4 deprecation warnings
14+
- Bug Fix `removeEmptyPairs` [#133](https://github.com/thephpleague/uri-src/issues/133)
15+
16+
### Deprecated
17+
18+
- None
19+
20+
### Removed
21+
22+
- None
23+
524
## [7.4.0](https://github.com/thephpleague/uri-components/compare/7.3.0...7.4.0) - 2023-12-01
625

726
### Added

components/UriModifier.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public static function removePairs(Psr7UriInterface|UriInterface $uri, string ..
6565
*/
6666
public static function removeEmptyPairs(Psr7UriInterface|UriInterface $uri): Psr7UriInterface|UriInterface
6767
{
68-
return Modifier::from($uri)->removeQueryPairsByKey()->getUri();
68+
return Modifier::from($uri)->removeEmptyQueryPairs()->getUri();
6969
}
7070

7171
/**

components/UriModifierTest.php

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?php
2+
3+
/**
4+
* League.Uri (https://uri.thephpleague.com)
5+
*
6+
* (c) Ignace Nyamagana Butera <[email protected]>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
declare(strict_types=1);
13+
14+
namespace League\Uri;
15+
16+
use PHPUnit\Framework\TestCase;
17+
18+
final class UriModifierTest extends TestCase
19+
{
20+
/** @test */
21+
public function it_will_remove_empty_pairs_fix_issue_133(): void
22+
{
23+
$removeEmptyPairs = fn (string $str): ?string => UriModifier::removeEmptyPairs(Http::createFromString($str))->getQuery(); /* @phpstan-ignore-line */
24+
25+
self::assertSame('', $removeEmptyPairs('https://a.b/c?d='));
26+
self::assertSame('', $removeEmptyPairs('https://a.b/c?=d'));
27+
self::assertSame('', $removeEmptyPairs('https://a.b/c?='));
28+
}
29+
}

0 commit comments

Comments
 (0)