diff --git a/lib/Cake/Test/Case/Utility/CakeTimeTest.php b/lib/Cake/Test/Case/Utility/CakeTimeTest.php index 27a7f7c4a..dffb7cc97 100644 --- a/lib/Cake/Test/Case/Utility/CakeTimeTest.php +++ b/lib/Cake/Test/Case/Utility/CakeTimeTest.php @@ -630,6 +630,11 @@ class CakeTimeTest extends CakeTestCase { $result = $this->Time->fromString(time(), $timezoneServer); $this->assertEquals($expected, $result); + + Configure::write('Config.timezone', $timezoneServer->getName()); + $result = $this->Time->fromString(time()); + $this->assertEquals($expected, $result); + Configure::delete('Config.timezone'); } /** diff --git a/lib/Cake/Utility/CakeTime.php b/lib/Cake/Utility/CakeTime.php index fa6427032..6078863d2 100644 --- a/lib/Cake/Utility/CakeTime.php +++ b/lib/Cake/Utility/CakeTime.php @@ -243,6 +243,10 @@ class CakeTime { $date = strtotime($dateString); } + if ($timezone === null) { + $timezone = Configure::read('Config.timezone'); + } + if ($timezone !== null) { return self::convert($date, $timezone); }