Problem
The reference MiniWebApp (#67, #246) and normal PHP micro-frameworks pass data into templates with:
$data = ['title' => 'Home', 'name' => $name];
extract($data);
include __DIR__ . '/../templates/home.php';
extract() / compact() are not in docs/capabilities.md or ext/standard/. Without them, templates either pollute scope manually or avoid include until much later.
Goal
VM + JIT support for:
extract(array $vars, int $flags = EXTR_SKIP) — at minimum EXTR_SKIP on string keys
compact(string ...$names) — build array from local variables (v1: literal name list only)
Scope
Acceptance criteria
docker run --rm -v "$(pwd):/compiler" -w /compiler php-compiler:22.04-dev \
./phpc run -r '$t=["name"=>"Dev"]; extract($t); echo $name;'
prints Dev in VM; same after JIT path lands.
Dependencies
Verification (local only)
make docker-build-22
docker run --rm -v "$(pwd):/compiler" -w /compiler php-compiler:22.04-dev \
./script/ci-local.sh --filter extract
Do not require GitHub Actions.
Related
Problem
The reference MiniWebApp (#67, #246) and normal PHP micro-frameworks pass data into templates with:
extract()/compact()are not indocs/capabilities.mdorext/standard/. Without them, templates either pollute scope manually or avoidincludeuntil much later.Goal
VM + JIT support for:
extract(array $vars, int $flags = EXTR_SKIP)— at minimumEXTR_SKIPon string keyscompact(string ...$names)— build array from local variables (v1: literal name list only)Scope
ext/standard/(may delegate to PHPextract/compactinitially)extract(['name' => 'Dev'])echoes variableext/standard/Module.php; updatescript/capability-matrix.phpoutputAcceptance criteria
prints
Devin VM; same after JIT path lands.Dependencies
includein JIT/AOT (templates are useless without includes)Verification (local only)
make docker-build-22 docker run --rm -v "$(pwd):/compiler" -w /compiler php-compiler:22.04-dev \ ./script/ci-local.sh --filter extractDo not require GitHub Actions.
Related
file_get_contents(asset loading)$datato templates)