Repository navigation
Conversation
DateTimeImmutable::createFromFormat() moves fields that are out of range into the next unit and only reports a warning. So a time of 2018-02-30T10:00:00Z was read as 2018-03-02T10:00:00Z and 24:30 became 00:30 on the next day. Such values are now rejected like any other invalid time. This includes a leap second like 23:59:60, which used to roll over to the next minute. Signed-off-by: emir <52245396+EmiRZx@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fixes #74.
decode()now checks the warnings fromDateTimeImmutable::getLastErrors()and throws the sameValueErroras for other invalid values. the deserializers still turn it intoInvalidAttributeException. valid values decode as before and forms like+0200are unchanged. a leap second like23:59:60is rejected too. it used to roll over to the next minute. Go, Python and JavaScript reject it as well.the six new cases fail on
mainand pass here. tests pass on PHP 8.1, 8.4 and 8.5. a check of 37 values gives the same results on 7.4, 8.0, 8.4 and 8.5 and only the ten values with out of range fields change. phpcs and psalm are clean. it merges cleanly with #68 and #72.