mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
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:
commit
8428928fd6
2 changed files with 8 additions and 0 deletions
|
@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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 (
|
||||
|
|
Loading…
Reference in a new issue