Skip to content

Commit

Permalink
made Cookie stringification more robust
Browse files Browse the repository at this point in the history
  • Loading branch information
fabpot committed Mar 4, 2014
1 parent fa24749 commit d014dac
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/Symfony/Component/BrowserKit/Cookie.php
Expand Up @@ -96,7 +96,7 @@ public function __toString()
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) {
Expand Down
Expand Up @@ -304,7 +304,7 @@ private function getCookieHeader($name, $value, $expires, $path, $domain, $secur
}
}

$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) {
Expand Down

0 comments on commit d014dac

Please sign in to comment.