Skip to content

Regression: AOT filesize() returns wrong size — VM/JIT match Zend (ext/standard/filestat.c) #27013

Description

@PurHur

Category

bug · php-src-strict · AOT · pillar 4

Problem

filesize() on a two-byte file matches Zend on VM and JIT (2), but the AOT binary returns a wrong size (35 observed on 712a1e64a).

Repro Zend / VM / JIT (2026-08-02, 712a1e64a) AOT bin/compile.php
file_put_contents(... ,"hi"); filesize(...) 2 builds; run prints 35 (not 2)

Silent wrong output — characteristic failure mode; compliance recorded expectations would miss this vs Zend.

php-src reference

PHP implementation target

  • ext/standard filestat path + AOT/JIT lowering in lib/JIT — PHP-in-PHP
  • Likely wrong path / cwd / return boxing under thin standalone; fix in PHP lowering, not new C

Repro

./script/docker-exec.sh -- bash -lc '
cat > /tmp/aot_filesize.php <<'"'"'PHP'"'"'
<?php
$path = "/tmp/aot_filesize_probe.txt";
file_put_contents($path, "hi");
echo filesize($path), "\n";
PHP
echo -n "zend="; php /tmp/aot_filesize.php
echo -n "vm="; php bin/vm.php /tmp/aot_filesize.php 2>/dev/null
echo -n "jit="; php bin/jit.php /tmp/aot_filesize.php 2>/dev/null | grep -v Deprecated
php bin/compile.php -o /tmp/aot_filesize /tmp/aot_filesize.php && /tmp/aot_filesize
'

Done when

  • AOT binary prints 2 matching Zend/VM/JIT
  • Prefer --repeat 10 on the built binary before claiming fixed
  • Compliance or test/repro/ guard
  • php-src-strict; no php-compiler-strict shortcut

Activity

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:compilerCompiler / CFG / JITbugSomething 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