ignore invalid cookies expires date format
This commit is contained in:
parent
f7ba71db7c
commit
f19788dd2e
@ -213,8 +213,6 @@ class Cookie
|
|||||||
if (false !== $date = date_create($dateValue, new \DateTimeZone('GMT'))) {
|
if (false !== $date = date_create($dateValue, new \DateTimeZone('GMT'))) {
|
||||||
return $date->format('U');
|
return $date->format('U');
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new \InvalidArgumentException(sprintf('Could not parse date "%s".', $dateValue));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -88,10 +88,11 @@ class CookieTest extends \PHPUnit_Framework_TestCase
|
|||||||
Cookie::fromString('foo');
|
Cookie::fromString('foo');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testFromStringThrowsAnExceptionIfCookieDateIsNotValid()
|
public function testFromStringIgnoresInvalidExpiresDate()
|
||||||
{
|
{
|
||||||
$this->setExpectedException('InvalidArgumentException');
|
$cookie = Cookie::fromString('foo=bar; expires=Flursday July 31st 2020, 08:49:37 GMT');
|
||||||
Cookie::fromString('foo=bar; expires=Flursday July 31st 2020, 08:49:37 GMT');
|
|
||||||
|
$this->assertFalse($cookie->isExpired());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testFromStringThrowsAnExceptionIfUrlIsNotValid()
|
public function testFromStringThrowsAnExceptionIfUrlIsNotValid()
|
||||||
|
Reference in New Issue
Block a user