Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
[Yaml] 🐛 throw ParseException on invalid date#57968
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
carsonbot commentedAug 9, 2024
Hey! Thanks for your PR. You are targeting branch "7.2" but it seems your PR description refers to branch "7.2 for features / 5.4, 6.4, and 7.1 for bug fixes". Cheers! Carsonbot |
stof left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
This needs some tests to prevent regressions
derrabus commentedAug 9, 2024
What does the YAML spec say about invalid date strings? Is the fallback to a plain string the expected behavior? |
homersimpsons commentedAug 9, 2024 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
I added a test. I do not know how far should I go with the "invalid dates"
I cannot seem to find anything searchinghttps://yaml.org/spec/1.2.2/ for "date", "invalid", "incorrect". I also searched for "date" inhttps://github.com/yaml/yaml-test-suite without success. I tried withhttps://github.com/yaml/yaml-reference-parser/blob/main/parser-1.2/javascript (I had to hack a bit around to make it work) but it looks like this is not checking explicitly for dates: |
xabbuh left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
https://yaml-online-parser.appspot.com/?yaml=date%3A+2024-50-50&type=python yields an error for invalid date and I think we should do the same (i.e. throw aParsException).
homersimpsons commentedAug 11, 2024
I changed the code to an exception. Which branch should I target? 5.4? 6.4? 7.1? |
derrabus commentedAug 11, 2024
5.4 |
homersimpsons commentedAug 11, 2024
Done, There was a conflict on |
derrabus commentedAug 11, 2024
Can you please adjust the PR title and description? They don't match the implemented logic anymore. |
homersimpsons commentedAug 11, 2024
Done. Tests are failing on twig but I didn't change anything there. |
xabbuh commentedAug 12, 2024
Thank you@homersimpsons. |

Uh oh!
There was an error while loading.Please reload this page.
(found insymfony-tools/docs-builder#179)
When parsing the following yaml:
symfony/yamlwill throw an exception:This is because the "month" is invalid. Fixing the "month" will trigger about the same issue because the "day" would be invalid.
With the current change it will throw a
ParseException.