Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 1b258e1

Browse filesBrowse files
bug #54910 [HttpFoundation]  filter out empty HTTP header parts (xabbuh)
This PR was merged into the 5.4 branch. Discussion ---------- [HttpFoundation]  filter out empty HTTP header parts | Q | A | ------------- | --- | Branch? | 5.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Issues | Fix #54868 | License | MIT Commits ------- 7d6d8cd filter out empty HTTP header parts
2 parents c656ad1 + 7d6d8cd commit 1b258e1
Copy full SHA for 1b258e1

File tree

Expand file treeCollapse file tree

2 files changed

+7
-1
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+7
-1
lines changed

‎src/Symfony/Component/HttpFoundation/HeaderUtils.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/HttpFoundation/HeaderUtils.php
+5-1Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,11 @@ private static function groupParts(array $matches, string $separators, bool $fir
286286
}
287287

288288
foreach ($partMatches as $matches) {
289-
$parts[] = '' === $separators ? self::unquote($matches[0][0]) : self::groupParts($matches, $separators, false);
289+
if ('' === $separators && '' !== $unquoted = self::unquote($matches[0][0])) {
290+
$parts[] = $unquoted;
291+
} elseif ($groupedParts = self::groupParts($matches, $separators, false)) {
292+
$parts[] = $groupedParts;
293+
}
290294
}
291295

292296
return $parts;

‎src/Symfony/Component/HttpFoundation/Tests/AcceptHeaderTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/HttpFoundation/Tests/AcceptHeaderTest.php
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ public static function provideFromStringData()
4141
{
4242
return [
4343
['', []],
44+
[';;;', []],
45+
['0', [new AcceptHeaderItem('0')]],
4446
['gzip', [new AcceptHeaderItem('gzip')]],
4547
['gzip,deflate,sdch', [new AcceptHeaderItem('gzip'), new AcceptHeaderItem('deflate'), new AcceptHeaderItem('sdch')]],
4648
["gzip, deflate\t,sdch", [new AcceptHeaderItem('gzip'), new AcceptHeaderItem('deflate'), new AcceptHeaderItem('sdch')]],

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.