-
Notifications
You must be signed in to change notification settings - Fork 789
these are not available in 32bit pack: q, Q, J, P #4644
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
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
divinity76
added a commit
to divinity76/wrench
that referenced
this pull request
May 1, 2025
off-by-1: previously, hybiframes with a 65536 bytes payload would generate a 16 bit size header signaling 0 bytes (pack("n", 65536) => "\x00\x00"), instead of using a 64bit size header. nit: composer.json php version had not been updated since 8.0.2 nit: instead of is_int && in_array, we can use in_array's strict mode. nit: $this->offset_mask and $this->offset_payload were initialized-to-null in constructor and encode, then written internally in getPayloadOffset, then written in encode() again. nit: use pack('J') instead of manually constructing big_endian_u64 (undocumented funfact, J is not available in 32bit php: php/doc-en#4644 , that may be why the original code did not use J) nit: use random_bytes instead of openssl_random_pseudo_bytes(), the original code was written for php5 where random_bytes did not exist. nit: getInitialLength() was calculating the result twice internally.
GrahamCampbell
pushed a commit
to chrome-php/wrench
that referenced
this pull request
May 1, 2025
* fix size 65536 HybiFrame + nitpicks off-by-1: previously, hybiframes with a 65536 bytes payload would generate a 16 bit size header signaling 0 bytes (pack("n", 65536) => "\x00\x00"), instead of using a 64bit size header. nit: composer.json php version had not been updated since 8.0.2 nit: instead of is_int && in_array, we can use in_array's strict mode. nit: $this->offset_mask and $this->offset_payload were initialized-to-null in constructor and encode, then written internally in getPayloadOffset, then written in encode() again. nit: use pack('J') instead of manually constructing big_endian_u64 (undocumented funfact, J is not available in 32bit php: php/doc-en#4644 , that may be why the original code did not use J) nit: use random_bytes instead of openssl_random_pseudo_bytes(), the original code was written for php5 where random_bytes did not exist. nit: getInitialLength() was calculating the result twice internally. * StyleCI * PR feedback https://github.com/chrome-php/wrench/pull/24/files#r2070000317 and https://github.com/chrome-php/wrench/pull/24/files#r2069999223
@nielsdos done! |
nielsdos
reviewed
May 7, 2025
nielsdos
approved these changes
May 7, 2025
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.
Thanks!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
see https://github.com/php/php-src/blob/156d034d3da314925a77115538b55c7097c662cc/ext/standard/pack.c#L320-L330
line 320-330.
(but I don't wanna say "64bit formats are not available in 32bit" because d, e, E, the float64 formats are available in 32bit builds, contrary to what the php-src error message suggest.)