Skip to content

Stdlib: touch() mtime/atime match Zend on VM + AOT (#28995) - #29012

Merged
PurHur merged 2 commits into
masterfrom
fix/28995-touch-mtime-atime
Aug 8, 2026
Merged

Stdlib: touch() mtime/atime match Zend on VM + AOT (#28995)#29012
PurHur merged 2 commits into
masterfrom
fix/28995-touch-mtime-atime

Conversation

@PurHur

@PurHur PurHur commented Aug 8, 2026

Copy link
Copy Markdown
Owner

Summary

php-src: ext/standard/filestat.cphp_touch / VCWD_UTIME.

Closes #28995

Test plan

  • Issue repro VM: php bin/vm.phpmtime_ok=y atime_ok=y (2-arg + 3-arg)
  • Issue repro AOT: PHP_COMPILER_HELPER_RUNTIME_O=0 ./phpc build … && ./binary → same
  • vendor/bin/phpunit --filter 'TouchBuiltinTest|FsDirRuntimeShrinkTest|VmFsTouchTempnamRuntimeShrinkTest' → OK (1 skipped JIT without llvm group)
  • php script/check-selfhost-spine-coverage-sync.php → OK 7250/7250
  • Not covered: full ci-fast.sh / compliance suite set-diff vs master

Made with Cursor

PurHur and others added 2 commits August 8, 2026 12:11
VmFsTouchPure used VmStatPath::exists(), which wrote a positive VmStatCache
hit before host utime — so the first filemtime/fileatime after a timed touch
returned “now”. Probe via uncached VmStatNative::stat and clear only the host
BG cache after a successful touch; keep VmStatCache positive hits until
clearstatcache (#25853).

Co-authored-by: Cursor <cursoragent@cursor.com>
NestedJIT FsDirJitHelper::touch cannot set times under thin AOT — host
\touch() re-enters __compiler_touch and FFI is unavailable in the native
binary. Route __compiler_touch through TouchLibcRuntime (libc utime) with
TOUCH_TIME_OMIT=PHP_INT_MIN; keep VmFsTouchPure for VM plus a quarantined
thin utime ABI fallback.

Co-authored-by: Cursor <cursoragent@cursor.com>
@PurHur
PurHur merged commit 6b3a050 into master Aug 8, 2026
@PurHur
PurHur deleted the fix/28995-touch-mtime-atime branch August 8, 2026 12:15
@PurHur
PurHur restored the fix/28995-touch-mtime-atime branch August 8, 2026 12:22
@PurHur
PurHur deleted the fix/28995-touch-mtime-atime branch August 8, 2026 16:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Stdlib: touch() ignores $mtime/$atime — always uses now (ext/standard/filestat.c)

1 participant