You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
date_parser accepts invalid dates and fails with a raw error on non-string inputs:
Out-of-range dates accepted: \DateTime::createFromFormat() parses an out-of-range value with a warning, the date overflowing, and DateParserTransformer does not check \DateTime::getLastErrors(). 2024-02-31 gives 2024-03-02, 2024-13-01 gives 2025-01-01 and 25:61 is accepted, while the documentation says that a value that cannot be parsed throws an exception.
Inputs other than a string: an int (e.g. a timestamp with the U format) or a \Stringable throws a raw TypeError (strict types), and so does an array.
Fix: throw an UnexpectedValueException when \DateTime::getLastErrors() reports warnings; cast the scalars and \Stringable to string, explicit UnexpectedValueException for the other values.
Found during the audit v3 (audit-v3-angles.md #195, and #202 for date_parser).
Activity
Merge pull request #403 from cleverage/402