Category
stdlib · php-src-strict
Problem
After fseek() fails on an empty php://memory stream, Zend reports the position as invalid (ftell() → false). The VM returns 0, so callers cannot distinguish a failed seek from a valid position at offset 0.
| Repro |
Zend 8.2 |
VM (2026-07-30) |
fseek($h, 99); ftell($h); on empty php://memory |
false |
0 |
php-src reference
PHP implementation target
ext/standard/VmPhpMemoryStream.php — seek() already returns -1 past end; tell() should return false when the last seek failed or position is past buffer (match Zend, not clamp to 0)
ext/standard/VmFs.php — ftell() passthrough for memory streams
Repro
./script/docker-exec.sh -- bash -lc 'php bin/vm.php test/repro/maintainer_gap_ftell_past_eof.php'
Done when
Category
stdlib· php-src-strictProblem
After
fseek()fails on an emptyphp://memorystream, Zend reports the position as invalid (ftell()→false). The VM returns0, so callers cannot distinguish a failed seek from a valid position at offset 0.fseek($h, 99); ftell($h);on emptyphp://memoryfalse0php-src reference
main/streams/memory.c—php_stream_memory_seekrejects past end; subsequent tell failsext/standard/file.c—php_ftellpropagates stream error statePHP implementation target
ext/standard/VmPhpMemoryStream.php—seek()already returns-1past end;tell()should returnfalsewhen the last seek failed or position is past buffer (match Zend, not clamp to 0)ext/standard/VmFs.php—ftell()passthrough for memory streamsRepro
./script/docker-exec.sh -- bash -lc 'php bin/vm.php test/repro/maintainer_gap_ftell_past_eof.php'Done when
ftell()returnsfalseafter failedfseek()onphp://memory, matching Zendtest/compliance/cases/stdlib/