-
Notifications
You must be signed in to change notification settings - Fork 14
Fix running on x86 #26
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -38,10 +38,12 @@ public function setValue($value) | |
| { | ||
| $value = (int)$value; | ||
|
|
||
| if ($value < 0) { | ||
| throw new \UnderflowException('Long integer value must be in the range 0 - 4294967296'); | ||
| } else if ($value > 0xffffffff) { | ||
| throw new \OverflowException('Long integer value must be in the range 0 - 4294967296'); | ||
| if (4 !== \PHP_INT_SIZE) { | ||
| if ($value < 0) { | ||
| throw new \UnderflowException('Long integer value must be in the range 0 - 4294967296'); | ||
| } else if ($value > 0xffffffff) { | ||
| throw new \OverflowException('Long integer value must be in the range 0 - 4294967296'); | ||
| } | ||
| } | ||
|
Comment on lines
+41
to
47
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If we're on 32 bit, values that should be positive (unsigned) will be negative, no?
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On 32-bit, we won't enter this branch because of the
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I know, but values decoding to large values will be negative on 32 bit, no? Shouldn't we reject those?
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nevermind, I guess it's fine that way. |
||
|
|
||
| $this->value = $value; | ||
|
|
||
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.
Technically, this is a BC break. Should we just fix the usage and leave this as is?
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.
This line is the culprit, php triggers the deprecation on this very line. It's a too big number on 32bit.
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.
See #28, WDYT?