Skip to content

php-in-php: pack('i'/'I') sizeof(int)=4 + backed enum parity (#5713) - #7986

Merged
PurHur merged 1 commit into
masterfrom
agent/runtime-php-pack-i-format-5713
Jun 11, 2026
Merged

php-in-php: pack('i'/'I') sizeof(int)=4 + backed enum parity (#5713)#7986
PurHur merged 1 commit into
masterfrom
agent/runtime-php-pack-i-format-5713

Conversation

@PurHur

@PurHur PurHur commented Jun 11, 2026

Copy link
Copy Markdown
Owner

Summary

C runtime: 0 lines added; all logic in PackEngine / JIT lowering.

Closes #5713

php-src reference

  • ext/standard/pack.cPHP_FUNCTION(pack), 'i'/'I' use sizeof(int)

Verification

./script/docker-exec.sh -- bash -lc 'source script/php-env.sh
php test/repro/parity_pack_backed_enum.php
php bin/vm.php test/repro/parity_pack_backed_enum.php
vendor/bin/phpunit --filter PackEngineTest
vendor/bin/phpunit --filter pack_backed_enum
'

Output:

len=4   # Zend
len=4   # VM
OK (8 tests, 23 assertions)   # PackEngineTest
OK (3 tests, 3 assertions)    # pack_backed_enum VM + JIT

Made with Cursor

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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Stdlib: pack() on backed enum operands — must warn and pack backing int, not VmJson::export fatal (ext/standard/pack.c)

1 participant