diff --git a/lib/Cake/Test/Case/Utility/CakeTimeTest.php b/lib/Cake/Test/Case/Utility/CakeTimeTest.php index 028723b93..95370c25b 100644 --- a/lib/Cake/Test/Case/Utility/CakeTimeTest.php +++ b/lib/Cake/Test/Case/Utility/CakeTimeTest.php @@ -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); } /** diff --git a/lib/Cake/Utility/CakeTime.php b/lib/Cake/Utility/CakeTime.php index 635d0612b..dc546d6ce 100644 --- a/lib/Cake/Utility/CakeTime.php +++ b/lib/Cake/Utility/CakeTime.php @@ -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 (