From 146f2abf914baa1ccb70824c088ded5839efe29e Mon Sep 17 00:00:00 2001 From: Roland Franssen Date: Tue, 20 Dec 2016 17:37:43 +0000 Subject: [PATCH] [HttpKernel] Continuation of #20599 for 3.2 --- .../DataCollector/RequestDataCollector.php | 43 +------------------ 1 file changed, 1 insertion(+), 42 deletions(-) diff --git a/src/Symfony/Component/HttpKernel/DataCollector/RequestDataCollector.php b/src/Symfony/Component/HttpKernel/DataCollector/RequestDataCollector.php index 0f2dc9b6c6084..e29cc9da4ddea 100644 --- a/src/Symfony/Component/HttpKernel/DataCollector/RequestDataCollector.php +++ b/src/Symfony/Component/HttpKernel/DataCollector/RequestDataCollector.php @@ -40,12 +40,8 @@ public function __construct() public function collect(Request $request, Response $response, \Exception $exception = null) { $responseHeaders = $response->headers->all(); - $cookies = array(); foreach ($response->headers->getCookies() as $cookie) { - $cookies[] = $this->getCookieHeader($cookie->getName(), $cookie->getValue(), $cookie->getExpiresTime(), $cookie->getPath(), $cookie->getDomain(), $cookie->isSecure(), $cookie->isHttpOnly()); - } - if (count($cookies) > 0) { - $responseHeaders['Set-Cookie'] = $cookies; + $responseHeaders['set-cookie'][] = (string) $cookie; } // attributes are serialized and as they can be anything, they need to be converted to strings. @@ -403,41 +399,4 @@ protected function parseController($controller) return is_string($controller) ? $controller : 'n/a'; } - - private function getCookieHeader($name, $value, $expires, $path, $domain, $secure, $httponly) - { - $cookie = sprintf('%s=%s', $name, urlencode($value)); - - if (0 !== $expires) { - if (is_numeric($expires)) { - $expires = (int) $expires; - } elseif ($expires instanceof \DateTime) { - $expires = $expires->getTimestamp(); - } else { - $tmp = strtotime($expires); - if (false === $tmp || -1 == $tmp) { - throw new \InvalidArgumentException(sprintf('The "expires" cookie parameter is not valid (%s).', $expires)); - } - $expires = $tmp; - } - - $cookie .= '; expires='.str_replace('+0000', '', \DateTime::createFromFormat('U', $expires, new \DateTimeZone('GMT'))->format('D, d-M-Y H:i:s T')); - } - - if ($domain) { - $cookie .= '; domain='.$domain; - } - - $cookie .= '; path='.$path; - - if ($secure) { - $cookie .= '; secure'; - } - - if ($httponly) { - $cookie .= '; httponly'; - } - - return $cookie; - } } pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy