-
Notifications
You must be signed in to change notification settings - Fork 118
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
Packing/unpacking the bin format family #72
Comments
Hey @rybakit! Good news first! Bad news is that we are just packing your data as string/raw this. Even though this is labled raw it was renamed to str in the new spec (but has the same leading bits)? So the a1(101) you are seeing is just a one byte string! All I did was diagnose stuff though, didn't give you any answers. I think everything is working correctly? Feel free to close if that answer is good, or I would be surprised if I was completely confused :) (I read this through about 5 times...) |
Right now we don't look at the string we are packing, so "\x80" is just handled like every other string. I will look at the Python library and see how they implemented packing (There isn't a dedicated binary type, so maybe they walk the string and decide based on its contents?) Is this behavior breaking PHP <-> Python for you right now? |
They check if the string is Unicode before packing it: ...
elif isinstance(obj, unicode):
_pack_string(obj, fp)
elif isinstance(obj, str):
_pack_binary(obj, fp)
...
I'm not affected by this right now, but I saw these tickets (#36, #53) were closed and assumed that the bin family is fully supported. I also wrote a pure php implementation of the msgpack protocol and tried to run my tests against this pecl extension and found that they fail on |
I really appreciate you making msgpack-php better just because! Sure needs some people who care about quality.. as I mess things up! Let me look at what I can do with this! The only part that is rough with this is that check will increase runtime. All I have is a char * + int, so I will have to see what the right way to handle that. thanks (also I owe you a merge and a bugfix already I should have time this week) |
Packing/unpacking bin data fails for me:
Expected:
string(6) "c40180"
Actual:
string(4) "a180"
Expected:
string(2) "80"
Actual:
PHP Warning: [msgpack] (php_msgpack_unserialize) Parse error in ...
The text was updated successfully, but these errors were encountered: