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; - } }
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: