made Cookie stringification more robust

This commit is contained in:
Fabien Potencier 2014-03-04 17:47:46 +01:00
parent fa24749537
commit d014dacce3
2 changed files with 2 additions and 2 deletions

View File

@ -96,7 +96,7 @@ class Cookie
throw new \UnexpectedValueException(sprintf('The cookie expiration time "%s" is not valid.'), $this->expires); throw new \UnexpectedValueException(sprintf('The cookie expiration time "%s" is not valid.'), $this->expires);
} }
$cookie .= '; expires='.substr($dateTime->format(self::$dateFormats[0]), 0, -5); $cookie .= '; expires='.str_replace('+0000', '', $dateTime->format(self::$dateFormats[0]));
} }
if ('' !== $this->domain) { if ('' !== $this->domain) {

View File

@ -304,7 +304,7 @@ class RequestDataCollector extends DataCollector implements EventSubscriberInter
} }
} }
$cookie .= '; expires='.substr(\DateTime::createFromFormat('U', $expires, new \DateTimeZone('UTC'))->format('D, d-M-Y H:i:s T'), 0, -5); $cookie .= '; expires='.str_replace('+0000', '', \DateTime::createFromFormat('U', $expires, new \DateTimeZone('GMT'))->format('D, d-M-Y H:i:s T'));
} }
if ($domain) { if ($domain) {