Skip to content

Stdlib: unlink() VM + LLVM JIT/AOT via libc unlink(2) #748

@PurHur

Description

@PurHur

Problem

Deploy and temp-file cleanup in compiled web apps need unlink():

@unlink($tmpPath);

Today only VM-adjacent file ops exist in patches; there is no unlink builtin in ext/standard/ with JIT/AOT lowering.

Goal

unlink(string $filename): bool with VM + JIT + AOT parity (libc unlink(2)), matching Zend semantics for missing files (false + warning).

Scope

  • VM: ext/standard/unlink.php or lib/VM/Builtin/ delegate to VmFs::unlink / unlink()
  • JIT: lib/JIT/Builtin/JitUnlink calling unlink(2)
  • AOT: same LLVM intrinsic path as other VmFs libc wrappers
  • Compliance: test/compliance/cases/standard/unlink.phpt
  • Unit: test/unit/UnlinkBuiltinTest.php (success + missing file)

Implementation hints

Layer Files Notes
Register ext/standard/ manifest, lib/JIT/Builtin/registry Follow rename() / #771 pattern
VM lib/VM.php builtin dispatch Return bool
JIT lib/JIT/Builtin/JitUnlink.php char* path from PHP string
Capability script/capability-matrix.php Regenerate row
// Minimal compliance case:
$file = sys_get_temp_dir() . '/phpc_unlink_test_' . getmypid();
file_put_contents($file, 'x');
var_export(unlink($file));
var_export(unlink($file)); // false

Acceptance criteria

./script/ci-fast.sh --filter UnlinkBuiltin
./script/ci-local.sh --filter unlink.phpt   # @group llvm when JIT/AOT enabled

Docker:

docker run --rm -v "$(pwd):/compiler" -w /compiler php-compiler:22.04-dev \
  ./script/ci-fast.sh --filter UnlinkBuiltin

No GitHub Actions.

Dependencies

Links

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions