8000 [HttpFoundation][Cookie] Cookie DateTimeInterface fix by wildewouter · Pull Request #17370 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[HttpFoundation][Cookie] Cookie DateTimeInterface fix #17370

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 6 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Fixed bug where not the interface DateTimeInterface but only the impl…
…ementation DateTime was accepted
  • Loading branch information
wildewouter committed Jan 14, 2016
commit 624448346964a490dfbd3618475d757377a385fa
2 changes: 1 addition & 1 deletion src/Symfony/Component/HttpFoundation/Cookie.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public function __construct($name, $value = null, $expire = 0, $path = '/', $dom
}

// convert expiration time to a Unix timestamp
if ($expire instanceof \DateTime) {
if ($expire instanceof \DateTimeInterface) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this does not work on PHP 5.3

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

instanceof \DateTime || instanceof \DateTimeInterface

489B
$expire = $expire->format('U');
} elseif (!is_numeric($expire)) {
$expire = strtotime($expire);
Expand Down
0