Skip to content

Navigation Menu

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 00ca74e

Browse filesBrowse files
committed
minor #27019 [HttpFoundation] Fixes to new HeaderUtils class (c960657)
This PR was squashed before being merged into the 4.1-dev branch (closes #27019). Discussion ---------- [HttpFoundation] Fixes to new HeaderUtils class | Q | A | ------------- | --- | Branch? | master | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | | License | MIT | Doc PR | A follow-up to #24699 with a few code and documentation fixes for post-merge review comments by @stof. Commits ------- d7c3c79 [HttpFoundation] Fixes to new HeaderUtils class
2 parents a9d12d2 + d7c3c79 commit 00ca74e
Copy full SHA for 00ca74e

File tree

2 files changed

+6
-6
lines changed
Filter options

2 files changed

+6
-6
lines changed

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

Copy file name to clipboardExpand all lines: src/Symfony/Component/HttpFoundation/AcceptHeaderItem.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public static function fromString($itemValue)
4343
$parts = HeaderUtils::split($itemValue, ';=');
4444

4545
$part = array_shift($parts);
46-
$attributes = HeaderUtils::combineParts($parts, 1);
46+
$attributes = HeaderUtils::combineParts($parts);
4747

4848
return new self($part[0], $attributes);
4949
}

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

Copy file name to clipboardExpand all lines: src/Symfony/Component/HttpFoundation/HeaderUtils.php
+5-5Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ private function __construct()
3131
* Example:
3232
*
3333
* HeaderUtils::split("da, en-gb;q=0.8", ",;")
34-
* // => array(array("da"), array("en-gb"), array("q", "0.8"))
34+
* // => array(array('da'), array('en-gb', 'q=0.8'))
3535
*
3636
* @param string $header HTTP header value
3737
* @param string $separators List of characters to split on, ordered by
@@ -42,7 +42,7 @@ private function __construct()
4242
*/
4343
public static function split(string $header, string $separators): array
4444
{
45-
$quotedSeparators = preg_quote($separators);
45+
$quotedSeparators = preg_quote($separators, '/');
4646

4747
preg_match_all('
4848
/
@@ -71,7 +71,7 @@ public static function split(string $header, string $separators): array
7171
* Each of the nested arrays should have one or two elements. The first
7272
* value will be used as the keys in the associative array, and the second
7373
* will be used as the values, or true if the nested array only contains one
74-
* element.
74+
* element. Array keys are lowercased.
7575
*
7676
* Example:
7777
*
@@ -94,13 +94,13 @@ public static function combineParts(array $parts): array
9494
* Joins an associative array into a string for use in an HTTP header.
9595
*
9696
* The key and value of each entry are joined with "=", and all entries
97-
* is joined with the specified separator and an additional space (for
97+
* are joined with the specified separator and an additional space (for
9898
* readability). Values are quoted if necessary.
9999
*
100100
* Example:
101101
*
102102
* HeaderUtils::joinAssoc(array("foo" => "abc", "bar" => true, "baz" => "a b c"), ",")
103-
* // => 'foo=bar, baz, baz="a b c"'
103+
* // => 'foo=abc, bar, baz="a b c"'
104104
*/
105105
public static function joinAssoc(array $assoc, string $separator): string
106106
{

0 commit comments

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