Category
php-in-php | bootstrap
Problem
glob() and unlink() VM paths call host ext/ffi via ext/standard/VmFsGlob.php and VmFsUnlink.php. When FFI is unavailable (AOT self-host bundle, hardened bootstrap image), glob() falls back to a PHP iterator and unlink() returns false without error — breaking deploy scripts and compiler hygiene that delete temp artifacts.
Bootstrap M2–M5 must not depend on Zend ext/ffi for core filesystem builtins.
php-src reference
Repro
A — unlink without FFI
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh
PHP_COMPILER_DISABLE_FFI=1 php bin/vm.php -r "
\$f = tempnam(sys_get_temp_dir(), \"t\");
var_export(file_exists(\$f));
var_export(unlink(\$f));
var_export(file_exists(\$f));
"'
If env gate missing today, simulate by temporarily forcing VmFsUnlink::ffi() null in a unit probe — document actual exit in PR.
B — glob parity
<?php
var_export(glob(__DIR__ . '/*.php', GLOB_NOSORT));
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh
php bin/vm.php repro.php
php repro.php
'
Scope (this repo)
| Module |
Path |
Notes |
| VM |
ext/standard/VmFsGlob.php, VmFsUnlink.php |
Replace FFI::cdef with compiled PHP lowering or thin AOT __compiler_unlink / __phpc_glob_vec already linked from phpc_stream.c / stream helpers |
| JIT/AOT |
lib/JIT/Builtin/ glob/unlink lowerers |
Mirror VM semantics |
| Registration |
ext/standard/glob_.php, unlink builtin |
|
| Tests |
test/compliance/cases/stdlib/glob_ffi_bootstrap.phpt, unlink_bootstrap.phpt |
|
Goal: delete or shrink FFI blocks in VmFsGlob.php / VmFsUnlink.php; any retained C is syscall trampoline only (document lines removed).
Done when
Verification
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && vendor/bin/phpunit --filter "glob_|unlink"'
make bootstrap-selfhost-helloworld
Related
Category
php-in-php|bootstrapProblem
glob()andunlink()VM paths call hostext/ffiviaext/standard/VmFsGlob.phpandVmFsUnlink.php. When FFI is unavailable (AOT self-host bundle, hardened bootstrap image),glob()falls back to a PHP iterator andunlink()returnsfalsewithout error — breaking deploy scripts and compiler hygiene that delete temp artifacts.Bootstrap M2–M5 must not depend on Zend
ext/ffifor core filesystem builtins.php-src reference
ext/standard/dir.c—PHP_FUNCTION(glob)ext/standard/filestat.c—php_unlink/unlink(2)glob(3),unlink(2)— thin syscall ABI only in C if unavoidableRepro
A — unlink without FFI
If env gate missing today, simulate by temporarily forcing
VmFsUnlink::ffi()null in a unit probe — document actual exit in PR.B — glob parity
Scope (this repo)
ext/standard/VmFsGlob.php,VmFsUnlink.phpFFI::cdefwith compiled PHP lowering or thin AOT__compiler_unlink/__phpc_glob_vecalready linked fromphpc_stream.c/ stream helperslib/JIT/Builtin/glob/unlink lowerersext/standard/glob_.php, unlink builtintest/compliance/cases/stdlib/glob_ffi_bootstrap.phpt,unlink_bootstrap.phptGoal: delete or shrink FFI blocks in
VmFsGlob.php/VmFsUnlink.php; any retained C is syscall trampoline only (document lines removed).Done when
unlink($path)succeeds on existing file in bootstrap image without hostext/ffiglob()returns same file list as Zend forGLOB_NOSORTsmoke onext/standard/*.phpmake bootstrap-selfhost-link/php script/bootstrap-inventory.php --checkunaffectedVerification
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && vendor/bin/phpunit --filter "glob_|unlink"' make bootstrap-selfhost-helloworldRelated