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 adc4a26

Browse filesBrowse files
Gabriel Moreirafabpot
Gabriel Moreira
authored andcommitted
[HttpKernel] Fixed RequestDataCollector handling of null header values.
1 parent 2d42689 commit adc4a26
Copy full SHA for adc4a26

File tree

Expand file treeCollapse file tree

2 files changed

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

2 files changed

+2
-1
lines changed

‎src/Symfony/Component/HttpKernel/DataCollector/RequestDataCollector.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/HttpKernel/DataCollector/RequestDataCollector.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ public function collect(Request $request, Response $response, \Exception $except
125125
continue;
126126
}
127127
if ('request_headers' === $key || 'response_headers' === $key) {
128-
$value = array_map(function ($v) { return isset($v[1]) ? $v : $v[0]; }, $value);
128+
$value = array_map(function ($v) { return isset($v[0]) && !isset($v[1]) ? $v[0] : $v; }, $value);
129129
}
130130
if ('request_server' !== $key && 'request_cookies' !== $key) {
131131
$this->data[$key] = array_map(array($this, 'cloneVar'), $value);

‎src/Symfony/Component/HttpKernel/Tests/DataCollector/RequestDataCollectorTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/HttpKernel/Tests/DataCollector/RequestDataCollectorTest.php
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,7 @@ protected function createResponse()
234234
$response = new Response();
235235
$response->setStatusCode(200);
236236
$response->headers->set('Content-Type', 'application/json');
237+
$response->headers->set('X-Foo-Bar', null);
237238
$response->headers->setCookie(new Cookie('foo', 'bar', 1, '/foo', 'localhost', true, true));
238239
$response->headers->setCookie(new Cookie('bar', 'foo', new \DateTime('@946684800')));
239240
$response->headers->setCookie(new Cookie('bazz', 'foo', '2000-12-12'));

0 commit comments

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