-
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert to encoding query with RFC3986
Bug fixed in league/uri-components 2.4.2 and 7.1.
- Loading branch information
Showing
3 changed files
with
18 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -102,15 +102,15 @@ public function testQueryWithEmptyValues(): void | |
|
||
public function testQueryWithEncodedChars(): void | ||
{ | ||
$query = 'key%5B1%5D=1%201&key%5B2%5D=2%261&key%5B3%5D=3%5B1%5D'; | ||
$query = 'key%5B1%5D=1+1&key%5B2%5D=2%261&key%5B3%5D=3%5B1%5D'; | ||
$request = $this->createTestRequest($query); | ||
self::assertSame('1 1', $request->getQueryParameter('key[1]')); | ||
self::assertSame('2&1', $request->getQueryParameter('key[2]')); | ||
self::assertSame('3[1]', $request->getQueryParameter('key[3]')); | ||
|
||
$request->setQueryParameter('key[3]', '3[2]'); | ||
$query = \str_replace('3%5B1%5D', '3%5B2%5D', $query); | ||
$query = \str_replace('%20', '+', $query); | ||
$query = \str_replace('+', '%20', $query); | ||
This comment has been minimized.
Sorry, something went wrong. |
||
self::assertSame($query, $request->getUri()->getQuery()); | ||
} | ||
|
||
|
@@ -184,7 +184,7 @@ public function testRemoveQuery(): void | |
|
||
public function testQueryWithEmptyPairs(): void | ||
{ | ||
$query = '&&&=to&&key=value&empty&encoded=%2B+%2B'; | ||
$query = '&&&=to&&key=value&empty&encoded=%2B%20%2B'; | ||
$request = $this->createTestRequest($query); | ||
|
||
self::assertSame([ | ||
|
@@ -233,6 +233,17 @@ public function testSettingNonStringValues(): void | |
$request->setQueryParameter('key4', [true]); | ||
} | ||
|
||
public function testBothRfc1738AndRfc3986EncodingAccepted(): void | ||
{ | ||
$rfc1738 = 'key=1+1'; | ||
$rfc3986 = 'key=1%201'; | ||
|
||
self::assertSame( | ||
$this->createTestRequest($rfc1738)->getQueryParameter('key'), | ||
$this->createTestRequest($rfc3986)->getQueryParameter('key'), | ||
); | ||
This comment has been minimized.
Sorry, something went wrong.
kelunik
Member
|
||
} | ||
|
||
public function testIsIdempotent(): void | ||
{ | ||
self::assertTrue($this->createTestRequest('', 'HEAD')->isIdempotent()); | ||
|
Instead of using str_replace, I'd rather state the full expected value explicitly here.