Category
stdlib
Problem
After basic pack() / unpack() exist, this build must match Zend for machine-dependent and explicitly sized integer formats and the @ alignment specifier. Float codes d/e/f/g are tracked in #4662; this issue covers integer / endian / padding codes from pack.c.
Typical gaps when not using host pack(): wrong endianness, wrong sizeof for P/p, @ skip misaligned, Q/J 64-bit layout.
php-src reference
Repro
<?php
// 32-bit little-endian unsigned (format N) vs machine (I)
$bin = pack('Nn', 0x11223344, 0x5566);
var_export(unpack('Nn', $bin));
echo "\n";
// padding / alignment
var_export(strlen(pack('I@4I', 1, 2)));
echo "\n";
// 64-bit (platform-dependent width for J/Q on 64-bit PHP)
var_export(unpack('P', pack('P', 0x1234)));
Compare Zend vs this compiler (VM):
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh
php repro_pack_int.php
php bin/vm.php repro_pack_int.php
'
Scope (this repo)
ext/standard/VmPack.php (or native port from bootstrap issue)
lib/AOT/runtime/ — __compiler_pack / __compiler_unpack
ext/standard/JitPack.php, ext/standard/JitUnpack.php
- Compliance:
test/compliance/cases/stdlib/pack_integer_endian.phpt
Done when
Related
#4662 float/double formats
#4673 bootstrap native pack (prerequisite if VmPack still delegates)
#4204 numeric-string length params on other builtins
Category
stdlibProblem
After basic
pack()/unpack()exist, this build must match Zend for machine-dependent and explicitly sized integer formats and the@alignment specifier. Float codesd/e/f/gare tracked in#4662; this issue covers integer / endian / padding codes frompack.c.Typical gaps when not using host
pack(): wrong endianness, wrongsizeofforP/p,@skip misaligned,Q/J64-bit layout.php-src reference
ext/standard/pack.c—pack_template,php_pack,php_unpack,endianness,@handlingRepro
Compare Zend vs this compiler (VM):
Scope (this repo)
ext/standard/VmPack.php(or native port from bootstrap issue)lib/AOT/runtime/—__compiler_pack/__compiler_unpackext/standard/JitPack.php,ext/standard/JitUnpack.phptest/compliance/cases/stdlib/pack_integer_endian.phptDone when
unpack()arrays forc/C,s/S,n/N,v/V,i/I,l/L,q/Q,j/J,p/Pon the CI target arch@alignment andx/X/Zpadding bytes matchpack.c#4532Related
#4662float/double formats#4673bootstrap native pack (prerequisite if VmPack still delegates)#4204numeric-string length params on other builtins