Skip to content

Commit c938372

Browse files
authored
Merge pull request #55 from thephpleague/2.4.x-fix-query-encoding
#109 Fix query encoding
2 parents 06f49e7 + 417fe03 commit c938372

File tree

8 files changed

+39
-21
lines changed

8 files changed

+39
-21
lines changed

.php-cs-fixer.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
'no_empty_comment' => true,
4949
'no_leading_import_slash' => true,
5050
'no_superfluous_phpdoc_tags' => true,
51-
'no_trailing_comma_in_singleline_array' => true,
51+
'no_trailing_comma_in_singleline' => true,
5252
'no_unused_imports' => true,
5353
'ordered_imports' => [
5454
'imports_order' => [
@@ -58,9 +58,7 @@
5858
],
5959
'sort_algorithm' => 'alpha',
6060
],
61-
'phpdoc_add_missing_param_annotation' => [
62-
'only_untyped' => false,
63-
],
61+
'phpdoc_add_missing_param_annotation' => ['only_untyped' => true],
6462
'phpdoc_align' => true,
6563
'phpdoc_no_empty_return' => true,
6664
'phpdoc_order' => true,
@@ -71,7 +69,7 @@
7169
'return_type_declaration' => [
7270
'space_before' => 'none',
7371
],
74-
'single_blank_line_before_namespace' => true,
72+
'blank_lines_before_namespace' => true,
7573
'single_quote' => true,
7674
'space_after_semicolon' => true,
7775
'ternary_operator_spaces' => true,

CHANGELOG.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,26 @@
22

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

5+
## [2.4.2](https://github.com/thephpleague/uri-components/compare/2.4.1...2.4.2) - 2023-08-12
6+
7+
### Added
8+
9+
- None
10+
11+
### Fixed
12+
13+
- conversion query component for non ASCII characters see [#109](https://github.com/thephpleague/uri-src/issues/109)
14+
15+
### Deprecated
16+
17+
- None
18+
19+
### Remove
20+
21+
- None
22+
23+
## 2.4.0 - 2021-08-02
24+
525
## [2.4.1](https://github.com/thephpleague/uri-components/compare/2.4.0...2.4.1) - 2022-05-26
626

727
### Added

composer.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,15 @@
3232
"psr/http-message": "^1.0"
3333
},
3434
"require-dev": {
35-
"friendsofphp/php-cs-fixer": "^v3.8.0",
35+
"friendsofphp/php-cs-fixer": "^v3.22.0",
3636
"guzzlehttp/psr7": "^2.2",
3737
"league/uri": "^6.0",
38-
"phpstan/phpstan": "^1.7",
39-
"phpstan/phpstan-phpunit": "^1.1",
40-
"phpstan/phpstan-strict-rules": "^1.2",
41-
"phpstan/phpstan-deprecation-rules": "^1.0",
42-
"phpunit/phpunit": "^9.5.20",
43-
"laminas/laminas-diactoros": "^2.11.0"
38+
"phpstan/phpstan": "^1.10.28",
39+
"phpstan/phpstan-phpunit": "^1.3.13",
40+
"phpstan/phpstan-strict-rules": "^1.5.1",
41+
"phpstan/phpstan-deprecation-rules": "^1.1.4",
42+
"phpunit/phpunit": "^9.6.10",
43+
"laminas/laminas-diactoros": "^2.11"
4444
},
4545
"suggest": {
4646
"ext-intl": "to handle IDN host",

src/Components/HierarchicalPath.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ public function getBasename(): string
243243
*/
244244
public function getExtension(): string
245245
{
246-
[$basename, ] = explode(';', $this->getBasename(), 2);
246+
[$basename] = explode(';', $this->getBasename(), 2);
247247

248248
return pathinfo($basename, PATHINFO_EXTENSION);
249249
}

src/Components/Host.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -437,7 +437,7 @@ public function withoutZoneIdentifier(): IpHostInterface
437437
return $this;
438438
}
439439

440-
[$ipv6, ] = explode('%', substr((string) $this->host, 1, -1));
440+
[$ipv6] = explode('%', substr((string) $this->host, 1, -1));
441441

442442
return static::createFromIp($ipv6);
443443
}

src/Components/QueryTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ public function testStringRepresentationComponent($input, $expected): void
138138

139139
public function queryProvider(): array
140140
{
141-
$unreserved = 'a-zA-Z0-9.-_~!$&\'()*+,;=:@';
141+
$unreserved = 'a-zA-Z0-9.-_~!$&\'()*,;=:@';
142142

143143
return [
144144
'bug fix issue 84' => ['fào=?%25bar&q=v%61lue', 'f%C3%A0o=?%25bar&q=value'],

src/QueryString.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ final class QueryString
6060
'suffixValue' => '*&',
6161
],
6262
PHP_QUERY_RFC3986 => [
63-
'suffixKey' => "!$'()*+,;:@?/%",
64-
'suffixValue' => "!$'()*+,;=:@?/&%",
63+
'suffixKey' => "!$'()*,;:@?/%",
64+
'suffixValue' => "!$'()*,;=:@?/&%",
6565
],
6666
];
6767

@@ -293,7 +293,7 @@ public static function build(iterable $pairs, string $separator = '&', int $enc_
293293

294294
$query = implode($separator, $res);
295295
if (PHP_QUERY_RFC1738 === $enc_type) {
296-
return str_replace(['+', '%20'], ['%2B', '+'], $query);
296+
return str_replace('%20', '+', $query);
297297
}
298298

299299
return $query;

src/QueryStringTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -379,9 +379,9 @@ public function buildProvider(): array
379379
'expected_rfc3986' => '0=0',
380380
],
381381
'rcf1738' => [
382-
'pairs' => [['toto', 'foo+bar']],
383-
'expected_rfc1738' => 'toto=foo%2Bbar',
384-
'expected_rfc3986' => 'toto=foo+bar',
382+
'pairs' => [['toto', 'foo+bar toto']],
383+
'expected_rfc1738' => 'toto=foo%2Bbar+toto',
384+
'expected_rfc3986' => 'toto=foo%2Bbar%20toto',
385385
],
386386
'utf-8 characters' => [
387387
'pairs' => [["\v\xED", "\v\xED"]],

0 commit comments

Comments
 (0)