From 07937d5a5f1d52b7bd99c34e037c7305956bd06f Mon Sep 17 00:00:00 2001 From: euromark Date: Tue, 19 Aug 2014 13:49:34 +0200 Subject: [PATCH 1/2] Correct typo. --- lib/Cake/Test/Fixture/AfterTreeFixture.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Cake/Test/Fixture/AfterTreeFixture.php b/lib/Cake/Test/Fixture/AfterTreeFixture.php index dd3775276..9dcc44997 100644 --- a/lib/Cake/Test/Fixture/AfterTreeFixture.php +++ b/lib/Cake/Test/Fixture/AfterTreeFixture.php @@ -18,7 +18,7 @@ */ /** - * AdFixture class + * AfterTreeFixture class * * @package Cake.Test.Fixture */ From 0400a630046430d43c60c346e1661618d3a00574 Mon Sep 17 00:00:00 2001 From: mark_story Date: Wed, 20 Aug 2014 00:25:01 +0200 Subject: [PATCH 2/2] Forward port fixes for #4294 from 1.3 to 2.x CakeTime was broken in the same way as TimeHelper was in 1.x. Getting 1969 on invalid input can be very confusing and un-helpful. Refs #4294 --- lib/Cake/Test/Case/Utility/CakeTimeTest.php | 6 ++++++ lib/Cake/Utility/CakeTime.php | 3 +++ 2 files changed, 9 insertions(+) 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'; }