-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
Support parsing YAML timestamps as DateTime #11838
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
Comments
Yeah, it is exactly the same (with more detauls in the message). I was quite sure I already suggested that. I don't know why I haven't seen it again when looking for it yesterday |
Why not dump something like !!php/datetime and use this whilst parsing? Then you get no BC break. |
@alexpott Great idea! |
@alexpott my goal is being able to parse standard YAML files in a way which is useful in PHP, and re-dumped in a compatible way. Currently, parsing and redumping a file containing a YAML timestamp breaks it by dumping a number. |
@Pitoune, @mehdichaouch and me will try to work on this issue. |
@francoismartin have you done any progress on this point ? |
I will try to submit a patch. |
Do I depreciate using the value false for the option ? |
see #17836 |
…buh) This PR was merged into the 3.1-dev branch. Discussion ---------- [Yaml] support to parse and dump DateTime objects | Q | A | ------------- | --- | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #6275, #8580, #11838, #14420 | License | MIT | Doc PR | TODO Commits ------- 7e1c6c4 [Yaml] support to parse and dump DateTime objects
Currently, YAML timestamps are pased into integers representing a Unix timestamp:
symfony/src/Symfony/Component/Yaml/Inline.php
Line 487 in f940d92
however, this is not very handy:
Dumping a YAML timestamp is actually impossible currently (if you format it as a YAML timestamp manually in a PHP string, it will be dumped as a string because the dumper knows that the string needs to be escaped).
So here is my proposal:
What do you think about it ?
The text was updated successfully, but these errors were encountered: