Merge pull request #1528 from mvdriel/caketime-fix

Added workaround for strtotime("0000-00-00 00:00:00") returning -6216995...
This commit is contained in:
ADmad 2013-08-15 10:55:03 -07:00
commit 8428928fd6
2 changed files with 8 additions and 0 deletions

View file

@ -583,6 +583,9 @@ class CakeTimeTest extends CakeTestCase {
$result = $this->Time->format('nonsense', '%d-%m-%Y', 'invalid', 'UTC');
$this->assertEquals('invalid', $result);
$result = $this->Time->format('0000-00-00', '%d-%m-%Y', 'invalid');
$this->assertEquals('invalid', $result);
}
/**

View file

@ -316,6 +316,11 @@ class CakeTime {
return false;
}
$containsDummyDate = (is_string($dateString) && substr($dateString, 0, 10) === '0000-00-00');
if ($containsDummyDate) {
return false;
}
if (is_int($dateString) || is_numeric($dateString)) {
$date = intval($dateString);
} elseif (