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
the serialization happens as expected on most of the scenarios and only fails if the format is wrong. for example: 2014-2222-02. However is doesn't fail when the month number is out of range: 2014-30-02.
I have tracked down the error to the class DateHandler and the method: parseDateTime. What is happening is that the conversion: \DateTime::createFromFormat($format, (string) $data, $timezone); will never throw an exception and return always true if the month number or month day is out of range. What it would do is save this as a warning and try to guess the date.
This warnings can be checked through \DateTime::getLastErrors(). I can see that this rightly done in DateTimeToStringTransformer object reverseTransform method.
Does that sound ok to you? Let me know what you think.
many thanks,
jose
The text was updated successfully, but these errors were encountered:
Hello,
I'm using FOSRestBundle with JMS Serializer. I bind request parameters using ParamConverter:
@ParamConverter("person", converter="fos_rest.request_body")
I see that this ParamConverter is calling this JMS Serializer internally. I have a problem with dates. For example I have the property:
/**
* @annotation\Expose
* @annotation\Type("DateTime<'Y-m-d'>")
*
*/
private $birthday;
the serialization happens as expected on most of the scenarios and only fails if the format is wrong. for example: 2014-2222-02. However is doesn't fail when the month number is out of range: 2014-30-02.
I have tracked down the error to the class DateHandler and the method: parseDateTime. What is happening is that the conversion: \DateTime::createFromFormat($format, (string) $data, $timezone); will never throw an exception and return always true if the month number or month day is out of range. What it would do is save this as a warning and try to guess the date.
This warnings can be checked through \DateTime::getLastErrors(). I can see that this rightly done in DateTimeToStringTransformer object reverseTransform method.
Does that sound ok to you? Let me know what you think.
many thanks,
jose
The text was updated successfully, but these errors were encountered: