Skip to content

[Yaml] Failing DateTime tests for Symfony\Component\Yaml\Tests\InlineTest #20399

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Einenlum opened this issue Nov 3, 2016 · 10 comments
Closed

Comments

@Einenlum
Copy link
Contributor

Einenlum commented Nov 3, 2016

PHPUnit tests are broken on master for Symfony\Component\Yaml\Tests\InlineTest.

There were 3 failures:

1) Symfony\Component\Yaml\Tests\InlineTest::testParseTimestampAsDateTimeObject with data set "date" ('2001-12-15', 2001, 12, 15, 0, 0, 0)
Failed asserting that two DateTime objects are equal.
--- Expected
+++ Actual
@@ @@
-2001-12-15T23:00:00+0000
+2001-12-14T23:00:00+0000

2) Symfony\Component\Yaml\Tests\InlineTest::testParseNestedTimestampListAsDateTimeObject with data set "date" ('2001-12-15', 2001, 12, 15, 0, 0, 0)
Failed asserting that two arrays are equal.
--- Expected
+++ Actual
@@ @@
 Array (
     'nested' => Array (
-        0 => 2001-12-15T23:00:00+0000
+        0 => 2001-12-14T23:00:00+0000
     )
 )

3) Symfony\Component\Yaml\Tests\ParserTest::testParseDateAsMappingValue
Failed asserting that two arrays are equal.
--- Expected
+++ Actual
@@ @@
 Array (
-    'date' => 2002-12-14T00:00:00+0000
+    'date' => 2002-12-13T23:00:00+0000
 )

FAILURES!
Tests: 559, Assertions: 787, Failures: 3.

Could it be linked to Daylight Saving Time?
(thanks @iltar for your help on this)

@linaori
Copy link
Contributor

linaori commented Nov 3, 2016

Additionally I also have this error that I think that could be related:

1) Symfony\Component\Serializer\Tests\Normalizer\DateTimeNormalizerTest::testDenormalizeUsingFormatPassedInContext
Failed asserting that two DateTime objects are equal.
--- Expected
+++ Actual
@@ @@
-2016-01-01T00:00:00+0000
+2016-01-01T00:00:00+0100

@Einenlum Einenlum changed the title Failing DateTime tests for Symfony\Component\Yaml\Tests\InlineTest [Tests] Failing DateTime tests for Symfony\Component\Yaml\Tests\InlineTest Nov 3, 2016
@Einenlum Einenlum changed the title [Tests] Failing DateTime tests for Symfony\Component\Yaml\Tests\InlineTest [Yaml] Failing DateTime tests for Symfony\Component\Yaml\Tests\InlineTest Nov 3, 2016
@Einenlum
Copy link
Contributor Author

Einenlum commented Nov 3, 2016

@iltar Indeed, same result for DateTimeNormalizerTest

@stof
Copy link
Member

stof commented Nov 3, 2016

@iltar what is your configured timezone ?

@linaori
Copy link
Contributor

linaori commented Nov 3, 2016

@stof

$ php -r "echo date_default_timezone_get();"
Europe/Amsterdam

@stof
Copy link
Member

stof commented Nov 3, 2016

I think these tests should force the timezone to be in UTC, as they expect the date to be dumped in UTC

@linaori
Copy link
Contributor

linaori commented Nov 3, 2016

Probably went right because of summer time :(

@Einenlum
Copy link
Contributor Author

Einenlum commented Nov 3, 2016

@iltar what is strange is I don't only have a diff of 1hour between what is get and what is expected. I have 1 day + 1 hour.

@nicolas-grekas
Copy link
Member

PHP 7.1 changed a bit here, I already patched master on similar issues in #20291

@xabbuh xabbuh added the Yaml label Nov 3, 2016
@stof
Copy link
Member

stof commented Nov 3, 2016

@nicolas-grekas has it been reported as a BC break to PHP ?

@nicolas-grekas
Copy link
Member

Nope, I didn't want to get there on internals ;)
And the change is borderline between bug fix and BC break. But I may be wrong so if someone wants to open the topic, please do!

nicolas-grekas added a commit that referenced this issue Nov 18, 2016
…sain)

This PR was merged into the 3.1 branch.

Discussion
----------

[YAML] Fix processing timestamp strings with timezone

| Q             | A
| ------------- | ---
| Branch?       | 3.1
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #20399
| License       | MIT
| Doc PR        | -

Parse date strings containing timezone data correctly
Default date strings not containing timezone data to UTC

Commits
-------

cdb11a7 [YAML] Fix processing timestamp with timezone
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants