8000 DateTimeToStringTransformerTest fails on PHP 5.3.3 · Issue #6429 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

DateTimeToStringTransformerTest fails on PHP 5.3.3 #6429

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
jakzal opened this issue Dec 19, 2012 · 4 comments
Closed

DateTimeToStringTransformerTest fails on PHP 5.3.3 #6429

jakzal opened this issue Dec 19, 2012 · 4 comments

Comments

@jakzal
Copy link
Contributor
jakzal commented Dec 19, 2012

Test fail with the following error:

Symfony\Component\Form\Tests\Extension\Core\DataTransformer\
  DateTimeToStringTransformerTest::testReverseTransformBeforePhp538 
   with data set #13 ('Y-z', '2010-33', '2010-02-03 00:00:00 UTC')
   200Symfony\Component\Form\Exception\TransformationFailedException: 
    The parsed date was invalid

Form/Extension/Core/DataTransformer/DateTimeToStringTransformer.php:146
Form/Tests/Extension/Core/DataTransformer/DateTimeToStringTransformerTest.php:109

I could only reproduce it on PHP 5.3.3.

@igorw
Copy link
Contributor
igorw commented Dec 20, 2012

The error is most likely from the call to DateTime::createFromFormat. I don't know why this happens though.

@jakzal
Copy link
Contributor Author
jakzal commented Dec 20, 2012

Right, it looks like a bug in PHP (inconsistent behaviour).

@jakzal
Copy link
Contributor Author
jakzal commented Dec 20, 2012

If I dump the contents of $lastErrors coming from DateTime::createFromFormat() in DateTimeToStringTransformer::reverseTransform() on PHP 5.3 I get:

array(4) {
  'warning_count' =>
  int(1)
  'warnings' =>
  array(1) {
    [10] =>
    string(27) "The parsed date was invalid"
  }
  'error_count' =>
  int(1)
  'errors' =>
  array(1) {
    [10] =>
    string(12) "Data missing"
  }
}

It doesn't happen on other PHP versions.

@norberttech
Copy link
Contributor

This error seems to appear only on creating date '2010-33' from format Y-z. https://github.com/symfony/symfony/blob/master/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToStringTransformerTest.php#L36

But when this line is removed next test with format z seems to pass without errors. This looks like a internal php error for me.

fabpot added a commit that referenced this issue Dec 23, 2012
This PR was merged into the 2.1 branch.

Commits
-------

8beee64 [Form] Fix for `DateTimeToStringTransformer`

Discussion
----------

[Form] Fix for `DateTimeToStringTransformer`

Closes: #6429

---------------------------------------------------------------------------

by stloyd at 2012-12-21T08:19:11Z

@fabpot @bschussek Could you review this ? Thanks =)

---------------------------------------------------------------------------

by stloyd at 2012-12-23T13:51:36Z

Ping @fabpot (without this every PR gets false fail results from Travis-CI)
@fabpot fabpot closed this as completed Dec 23, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants
0