Skip to content

Commit d014dac

Browse files
committed
made Cookie stringification more robust
1 parent fa24749 commit d014dac

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/Symfony/Component/BrowserKit/Cookie.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ public function __toString()
9696
throw new \UnexpectedValueException(sprintf('The cookie expiration time "%s" is not valid.'), $this->expires);
9797
}
9898

99-
$cookie .= '; expires='.substr($dateTime->format(self::$dateFormats[0]), 0, -5);
99+
$cookie .= '; expires='.str_replace('+0000', '', $dateTime->format(self::$dateFormats[0]));
100100
}
101101

102102
if ('' !== $this->domain) {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ private function getCookieHeader($name, $value, $expires, $path, $domain, $secur
304304
}
305305
}
306306

307-
$cookie .= '; expires='.substr(\DateTime::createFromFormat('U', $expires, new \DateTimeZone('UTC'))->format('D, d-M-Y H:i:s T'), 0, -5);
307+
$cookie .= '; expires='.str_replace('+0000', '', \DateTime::createFromFormat('U', $expires, new \DateTimeZone('GMT'))->format('D, d-M-Y H:i:s T'));
308308
}
309309

310310
if ($domain) {

0 commit comments

Comments
 (0)