-
Notifications
You must be signed in to change notification settings - Fork 104
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
Support int64 in arguments #165
Conversation
911a913
to
6162894
Compare
If preferred, I can change it to only encode |
That would make sense tbh. Was going to ask if this impacts #139, and that this obviously requires 64bit PHP. (Which I assume pretty much everyone uses these days.) |
I don't know how this relates to #139... It doesn't actually require 64-bit PHP, it checks for 64-bit support here and on 32-bit system encodes large numbers in halves here. So it should not break anything to use $buffer->appendUint8(Constants::FIELD_LONG_LONG_INT);
$buffer->appendInt64($value); or (because on 32-bit system you are unable to set larger if (PHP_INT_SIZE === 4) {
$buffer->appendUint8(Constants::FIELD_LONG_INT);
$buffer->appendInt32($value);
} else {
$buffer->appendUint8(Constants::FIELD_LONG_LONG_INT);
$buffer->appendInt64($value);
} |
Good, wasn't this expecting it to be but wanted to make sure.
Fair, and on 32bit systems you can't pass an integer requiring to use
This one works for me, just to be slightly more on the safe side. |
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.
Awesome! Thanks for putting the final touches on this PR 👍
When consuming stream queue, you send starting numeric offset value as header argument.
When offset is larger then limit of
int32
, it starts returning messages from the beginning of the queue due to offset overflow because now any int is encoded like this:The simplest solution is to use
int64
instead, which works for anyint
from PHP code, or (as in this PR) at least supportint64
withint32
as the default for smaller numbers.