diff --git a/lib/Cake/Test/Case/Utility/CakeTimeTest.php b/lib/Cake/Test/Case/Utility/CakeTimeTest.php index e0a4182c4..2d06e7d11 100644 --- a/lib/Cake/Test/Case/Utility/CakeTimeTest.php +++ b/lib/Cake/Test/Case/Utility/CakeTimeTest.php @@ -597,6 +597,12 @@ class CakeTimeTest extends CakeTestCase { $result = $this->Time->format('Y-m-d', null, 'never'); $this->assertEquals('never', $result); + $result = $this->Time->format('Y-m-d', ''); + $this->assertSame('', $result); + + $result = $this->Time->format('Y-m-d', false); + $this->assertSame('', $result); + $result = $this->Time->format('2012-01-13', '%d-%m-%Y', 'invalid'); $this->assertEquals('13-01-2012', $result); diff --git a/lib/Cake/Utility/CakeTime.php b/lib/Cake/Utility/CakeTime.php index 021e499ff..136fb311a 100644 --- a/lib/Cake/Utility/CakeTime.php +++ b/lib/Cake/Utility/CakeTime.php @@ -1053,6 +1053,9 @@ class CakeTime { if ($date === false && $default !== false) { return $default; } + if ($date === false) { + return ''; + } if (empty($format)) { $format = '%x'; }