diff --git a/src/Symfony/Component/Yaml/Inline.php b/src/Symfony/Component/Yaml/Inline.php index b96e79cb24..2a7c649970 100644 --- a/src/Symfony/Component/Yaml/Inline.php +++ b/src/Symfony/Component/Yaml/Inline.php @@ -588,7 +588,7 @@ class Inline return (float) str_replace(',', '', $scalar); case preg_match(self::getTimestampRegex(), $scalar): if (Yaml::PARSE_DATETIME & $flags) { - return new \DateTime($scalar,new \DateTimeZone('UTC')); + return new \DateTime($scalar, new \DateTimeZone('UTC')); } $timeZone = date_default_timezone_get(); diff --git a/src/Symfony/Component/Yaml/Tests/InlineTest.php b/src/Symfony/Component/Yaml/Tests/InlineTest.php index 935f6a72a8..00557ea747 100644 --- a/src/Symfony/Component/Yaml/Tests/InlineTest.php +++ b/src/Symfony/Component/Yaml/Tests/InlineTest.php @@ -495,7 +495,8 @@ class InlineTest extends \PHPUnit_Framework_TestCase */ public function testParseTimestampAsDateTimeObject($yaml, $year, $month, $day, $hour, $minute, $second) { - $expected = new \DateTime('now', new \DateTimeZone('UTC')); + $expected = new \DateTime($yaml); + $expected->setTimeZone(new \DateTimeZone('UTC')); $expected->setDate($year, $month, $day); $expected->setTime($hour, $minute, $second);