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

Coder.php misparses floats on little-endian architectures #1

Open
GoogleCodeExporter opened this issue Mar 19, 2015 · 0 comments
Open

Comments

@GoogleCodeExporter
Copy link

What steps will reproduce the problem?
1. Generate a (correct) Messagepacked structure containing a float (say, 
1234.5).
2. Parse it with Coder.php
3. Compare it with the original number.

What is the expected output? What do you see instead?
- Expected output, 1234.5... actual output, something*10^41.

What version of the product are you using? On what operating system?
- i686 AFAIK, on an Amazon instance.

Please provide any additional information below.
- Messagepack specifies big-endian floats, so on little-endian hardware I had 
to do this instead (Coder.php line 196):
  $unpack = unpack('f', strrev(substr($messagePack, 0, 4)));

Original issue reported on code.google.com by [email protected] on 30 Sep 2013 at 12:04

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

No branches or pull requests

1 participant