-
Notifications
You must be signed in to change notification settings - Fork 160
Handle Datetime serialization #148
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
Conversation
|
Any update ? |
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.
LGTM. Please also re-base with master. Thank you
@tchiotludo
| if ($val instanceof Serializable) { | ||
| return $val->serialize(); | ||
| } else if ($val instanceof \DateTimeImmutable) { | ||
| return $val->format('Y-m-d H:i:s.u'); |
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.
use ISO 8601 instead of hard-code date time format $val->format('c')
|
done & thanks 👍 |
|
Please fix travis error (PSR2) @tchiotludo then we are good to go. |
|
thanks @tchiotludo |
|
np @haphan, good to see my fork disappear 😄 |
|
@tchiotludo As we are trying to maintain branch 2.x till end of March 2018, can you also back-port this fix to branch 2.0 Thanks. |
The serialize method don't handle correctly
\DateTimeImmutableThe unserialize method expect a string (\DateTimeImmutable constructor)
But the serialize method serialize '\DateTimeImmutable' as object
This throw an
DateTimeImmutable::__construct() expects parameter 1 to be string, object givenon calling->populateFromArray((array) $serialize)