php-in-php: pack('i'/'I') sizeof(int)=4 + backed enum parity (#5713) - #7986
Merged
Conversation
PackEngine/UnpackEngine and JIT lowering used PHP_INT_SIZE (8 on 64-bit) instead of php-src's 4-byte 'i' format; pack() now validates operands even when the return is discarded. Co-authored-by: Cursor <cursoragent@cursor.com>
4 tasks
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
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.
Summary
pack('i'/'I')and matchingunpack()to use 4 bytes (sizeof(int)per php-srcext/standard/pack.c) instead ofPHP_INT_SIZE(8 on 64-bit hosts).pack()VM builtin now runs operand validation even when the return value is discarded (Stdlib: VM builtins skip arg validation when return is discarded (returnVar null early-return) #5896 tail).pack('i', E::A)length check; fixed??coalesce in test bodies (parser gap).C runtime: 0 lines added; all logic in
PackEngine/ JIT lowering.Closes #5713
php-src reference
ext/standard/pack.c—PHP_FUNCTION(pack),'i'/'I'usesizeof(int)Verification
Output:
Made with Cursor