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

Big/little endian assumptions. #39

Open
bbkr opened this issue Jun 6, 2018 · 0 comments
Open

Big/little endian assumptions. #39

bbkr opened this issue Jun 6, 2018 · 0 comments

Comments

@bbkr
Copy link

bbkr commented Jun 6, 2018

Following code https://github.com/krowinski/php-mysql-replication/blob/master/src/MySQLReplication/BinaryDataReader/BinaryDataReader.php#L72 works by accident because s uses native architecture. And every Intel/AMD CPU is in little endian architecture which is the same as binlog bytes layout.

Architecture should be forced in unpack pattern ( s< - like in Perl, I'm not sure if PHP supports it).
Or native architecture should be checked and bytes reversed before unpacking in case of mismatch.

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

2 participants