Category
php-in-php | stdlib
Problem
ext/standard/VmGzStreamNative.php opens compress.zlib:// streams via libz FFI (gzopen, gzread, gzwrite, gzclose). Bootstrap and self-host paths already have pure-PHP zlib encode/decode (VmZlibNative, ext/zstd-style migration #8837); gz stream wrappers should follow the same PHP-in-PHP strategy.
php-src reference
Repro
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh
grep -c "FFI" ext/standard/VmGzStreamNative.php
php bin/vm.php test/repro-maintainer/gzcompress_native_only.php 2>/dev/null || true'
Add test/repro-maintainer/gz_stream_php_in_php_probe.php:
<?php
$path = sys_get_temp_dir() . '/phpc_gz_probe_' . getmypid() . '.gz';
$zp = gzopen($path, 'wb9');
gzwrite($zp, 'hello');
gzclose($zp);
$zr = gzopen($path, 'rb');
echo gzread($zr, 100), "\n";
gzclose($zr);
unlink($path);
| Runtime |
Expected |
| Zend |
hello |
| VM today |
works via libz FFI |
Done target: same output with no libz FFI in VmGzStreamNative.
Scope
| Layer |
Path |
| PHP |
New ext/standard/VmGzStreamPure.php or extend VmZlibNative with stream handle table |
| VM |
ext/standard/gzopen.php, gzread.php, VmFs.php gz placeholder adoption |
| JIT |
lib/JIT/Builtin/GzStreamIoJit.php — share core with VM |
| Tests |
test/unit/VmZlibNativeTest.php, compliance gz stream PHPT |
Done when (php-src-strict)
Related
#6168 · #8837 · #8868 · #1492
Category
php-in-php|stdlibProblem
ext/standard/VmGzStreamNative.phpopenscompress.zlib://streams via libz FFI (gzopen,gzread,gzwrite,gzclose). Bootstrap and self-host paths already have pure-PHP zlib encode/decode (VmZlibNative,ext/zstd-style migration #8837); gz stream wrappers should follow the same PHP-in-PHP strategy.php-src reference
ext/zlib/zlib.c—php_gzopen, stream opsext/zlib/zlib_fopen_wrapper.c—compress.zlib://wrapperRepro
Add
test/repro-maintainer/gz_stream_php_in_php_probe.php:helloDone target: same output with no libz FFI in
VmGzStreamNative.Scope
ext/standard/VmGzStreamPure.phpor extendVmZlibNativewith stream handle tableext/standard/gzopen.php,gzread.php,VmFs.phpgz placeholder adoptionlib/JIT/Builtin/GzStreamIoJit.php— share core with VMtest/unit/VmZlibNativeTest.php, compliance gz stream PHPTDone when (php-src-strict)
VmGzStreamNativeFFI removed; gz stream repro passes on VMmake north-star5-verify-fastgreen after self-host spine touches gz pathsRelated
#6168 · #8837 · #8868 · #1492