Skip to content

Regression: fstat Reflection return array — Zend array|false (ext/standard/file.stub.php) #28483

Description

@PurHur

Category

bug · php-src-strict · Reflection return type · ext/standard

Problem

ReflectionFunction('fstat')->getReturnType() is array on php-compiler and array|false on Zend. Runtime fstat can fail; the stub must advertise |false. Distinct from #23597 (param name $fp vs $stream). Probed 2026-08-07 @ 3b042898ae.

Repro Zend 8.2 (2026-08-07) VM (2026-08-07)
ReflectionFunction('fstat')->getReturnType() array|false array

php-src reference

PHP implementation target

Repro

./script/docker-exec.sh -- bash -lc \"php -r \\"echo (new ReflectionFunction('fstat'))->getReturnType();\\"\"
./script/docker-exec.sh -- bash -lc \"php bin/vm.php -r \\"echo (new ReflectionFunction('fstat'))->getReturnType();\\"\"
# or:
php -r 'echo (new ReflectionFunction(\"fstat\"))->getReturnType(), PHP_EOL;'
php bin/vm.php -r 'echo (new ReflectionFunction(\"fstat\"))->getReturnType(), PHP_EOL;'

Done when

  • Reflection return type is array\|false matching Zend
  • Named/positional fstat behavior unchanged
  • php-src-strict; small Reflection/compliance guard

Activity

  1. added
    bugSomething isn't working
    phase-4:stdlibPhase 4 – stdlib for web apps
    area:vmVirtual machine
    implementation-readySpec complete: repro, php-src ref, done-when — safe for workers to claim
    on Aug 7, 2026
  2. PurHur commented on Aug 7, 2026

    @PurHur
    OwnerAuthor

    Self-contained repro

    ./script/docker-exec.sh -- bash -lc '
    echo -n "Zend: "; php -r "echo (new ReflectionFunction(\"fstat\"))->getReturnType(), PHP_EOL;"
    echo -n "VM:   "; php bin/vm.php -r "echo (new ReflectionFunction(\"fstat\"))->getReturnType(), PHP_EOL;"
    '

    Expect Zend array|false, VM today array.

  3. PurHur commented on Aug 10, 2026

    @PurHur
    OwnerAuthor

    claim: PHP Compiler STD Lib Advanced — batch (issues #28842, #28919, #28483, #28520, #28557)

  4. PurHur commented on Aug 11, 2026

    @PurHur
    OwnerAuthor

    Cleanup note (branch kept)

    Remote agent/advanced-stdlib-28483-fstat-reflection still exists (1 commit ahead of master, no open PR): BuiltinInternalArgInfo fstat → array|false + repro/compliance/unit. Leaving it while #28483 is open for a worker to rebase/open PR — not deleting.

    Prior batch claim left no merged PR; next stdlib agent can reclaim from that branch tip.

  5. PurHur commented on Aug 11, 2026

    @PurHur
    OwnerAuthor

    claim: PHP Compiler STD Lib Advanced — batch (issues #28483, #28520, #28557)

    Continuing prior Advanced handoff: remote branch agent/advanced-stdlib-28483-fstat-reflection rebased onto current master; shipping #28483 first, then #28520/#28557 sequentially.

  6. PurHur commented on Aug 11, 2026

    @PurHur
    OwnerAuthor

    Merged via #30085

    Verification:

    • master BuiltinInternalArgInfo → VM Reflection array; branch → array|false
    • php bin/vm.php test/repro/issue_28483_fstat_reflection_return.php → array|false
    • PHPUnit testFstatStubReturnArrayFalse + FstatReflectionReturnVMTest OK

    Next in batch: #28520 (tmpfile/fopen untyped returns), then #28557 (file → array|false).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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