Skip to content

Commit e1616b3

Browse files
committed
[HttpKernel] Continuation of symfony#20569
1 parent d29fc2c commit e1616b3

File tree

1 file changed

+1
-47
lines changed

1 file changed

+1
-47
lines changed

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

Lines changed: 1 addition & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,6 @@ public function __construct()
3939
*/
4040
public function collect(Request $request, Response $response, \Exception $exception = null)
4141
{
42-
$responseHeaders = $response->headers->all();
43-
$cookies = array();
44-
foreach ($response->headers->getCookies() as $cookie) {
45-
$cookies[] = $this->getCookieHeader($cookie->getName(), $cookie->getValue(), $cookie->getExpiresTime(), $cookie->getPath(), $cookie->getDomain(), $cookie->isSecure(), $cookie->isHttpOnly());
46-
}
47-
if (count($cookies) > 0) {
48-
$responseHeaders['Set-Cookie'] = $cookies;
49-
}
50-
5142
// attributes are serialized and as they can be anything, they need to be converted to strings.
5243
$attributes = array();
5344
$route = '';
@@ -99,7 +90,7 @@ public function collect(Request $request, Response $response, \Exception $except
9990
'request_cookies' => $request->cookies->all(),
10091
'request_attributes' => $attributes,
10192
'route' => $route,
102-
'response_headers' => $responseHeaders,
93+
'response_headers' => $response->headers->all(),
10394
'session_metadata' => $sessionMetadata,
10495
'session_attributes' => $sessionAttributes,
10596
'flashes' => $flashes,
@@ -403,41 +394,4 @@ protected function parseController($controller)
403394

404395
return is_string($controller) ? $controller : 'n/a';
405396
}
406-
407-
private function getCookieHeader($name, $value, $expires, $path, $domain, $secure, $httponly)
408-
{
409-
$cookie = sprintf('%s=%s', $name, urlencode($value));
410-
411-
if (0 !== $expires) {
412-
if (is_numeric($expires)) {
413-
$expires = (int) $expires;
414-
} elseif ($expires instanceof \DateTime) {
415-
$expires = $expires->getTimestamp();
416-
} else {
417-
$tmp = strtotime($expires);
418-
if (false === $tmp || -1 == $tmp) {
419-
throw new \InvalidArgumentException(sprintf('The "expires" cookie parameter is not valid (%s).', $expires));
420-
}
421-
$expires = $tmp;
422-
}
423-
424-
$cookie .= '; expires='.str_replace('+0000', '', \DateTime::createFromFormat('U', $expires, new \DateTimeZone('GMT'))->format('D, d-M-Y H:i:s T'));
425-
}
426-
427-
if ($domain) {
428-
$cookie .= '; domain='.$domain;
429-
}
430-
431-
$cookie .= '; path='.$path;
432-
433-
if ($secure) {
434-
$cookie .= '; secure';
435-
}
436-
437-
if ($httponly) {
438-
$cookie .= '; httponly';
439-
}
440-
441-
return $cookie;
442-
}
443397
}

0 commit comments

Comments
 (0)