Skip to content

Regression: ftell() returns 0 after failed fseek on php://memory — Zend false (ext/standard/streams.c) #25299

Description

@PurHur

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.phpseek() 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.phpftell() 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

  • ftell() returns false after failed fseek() on php://memory, matching Zend
  • Compliance guard under test/compliance/cases/stdlib/
  • php-src-strict; VM/JIT agree when both in scope

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:vmVirtual machinebugSomething isn't workingimplementation-readySpec complete: repro, php-src ref, done-when — safe for workers to claimphase-4:stdlibPhase 4 – stdlib for web appsstdlib

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions