Skip to content
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

PHP Fails to Deserialize Date Objects Created in Javascript #127

Open
doc987 opened this issue Aug 6, 2018 · 3 comments
Open

PHP Fails to Deserialize Date Objects Created in Javascript #127

doc987 opened this issue Aug 6, 2018 · 3 comments
Labels

Comments

@doc987
Copy link

doc987 commented Aug 6, 2018

If a Date object is created in Javascript (new Date()), and is serialized with MessagePack, then PHP will fail to deserialize with the following message:
PHP Warning: [msgpack] (php_msgpack_unserialize) Parse error

This happens if the Date object is by itself, or part of another object. It also happens if the serialization is done with either of the two javascript libraries listed on https://msgpack.org

MessagePack Specification: https://github.com/msgpack/msgpack/blob/master/spec.md

Expected Behavior: Javascript Date is deserialized to PHP DateTime.

@rybakit
Copy link
Contributor

rybakit commented Aug 6, 2018

Unfortunately, msgpack-php doesn't support the ext type yet (see this comment). As a workaround, you can use the pure php msgpack library.

@doc987
Copy link
Author

doc987 commented Aug 6, 2018

Are there plans to do so, or is this library no longer being maintained? I noticed there hasn't been a release since December 6, 2016. I would generally prefer an extension as they are likely to have better performance (and one of the benefits of MessagePack is better performance), but if the PHP implementation is the one being maintained, then that would be a better choice. Is it recommended that the PHP implementation be used for new projects instead of the PHP extension?

carlwgeorge pushed a commit to iusrepo/php73-pecl-msgpack that referenced this issue Jun 11, 2019
@m6w6 m6w6 added the interop label Dec 18, 2019
@m6w6
Copy link
Collaborator

m6w6 commented Dec 18, 2019

This is on the roadmap now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants