diff --git a/src/Symfony/Component/Yaml/Inline.php b/src/Symfony/Component/Yaml/Inline.php index b96e79cb2450d..2a7c649970a81 100644 --- a/src/Symfony/Component/Yaml/Inline.php +++ b/src/Symfony/Component/Yaml/Inline.php @@ -588,7 +588,7 @@ private static function evaluateScalar($scalar, $flags, $references = array()) 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 935f6a72a84c1..00557ea747287 100644 --- a/src/Symfony/Component/Yaml/Tests/InlineTest.php +++ b/src/Symfony/Component/Yaml/Tests/InlineTest.php @@ -495,7 +495,8 @@ public function testParseTimestampAsUnixTimestampByDefault($yaml, $year, $month, */ 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);