Problem
PHP web templates and APIs rely on double-quoted strings with embedded variables:
echo "Hello, $name";
echo "Route: {$route}";
If php-cfg emits Scalar_Encapsed / encapsed string parts that lib/Compiler.php does not lower, compilation fails with Unsupported expression or wrong output. Concatenation ('Hello ' . $name) works but is verbose and common in real apps (#67, templates in #246).
Goal
Support standard double-quoted interpolation in VM, JIT, and AOT for:
- Simple variables:
"$name"
- Complex expressions in braces:
"{$user['id']}", "{$obj->method()}" (v1 may limit to variables/array offsets)
Scope
Acceptance criteria
$name = 'Dev';
echo "Hello, $name\n";
Identical output in bin/vm.php and bin/jit.php.
Verification (local only)
./script/ci-local.sh --filter encapsed
docker run --rm -v "$(pwd):/compiler" -w /compiler php-compiler:22.04-dev \
./script/ci-local.sh --filter encapsed
No GitHub Actions required.
Dependencies
Related
Problem
PHP web templates and APIs rely on double-quoted strings with embedded variables:
If php-cfg emits
Scalar_Encapsed/ encapsed string parts thatlib/Compiler.phpdoes not lower, compilation fails withUnsupported expressionor wrong output. Concatenation ('Hello ' . $name) works but is verbose and common in real apps (#67, templates in #246).Goal
Support standard double-quoted interpolation in VM, JIT, and AOT for:
"$name""{$user['id']}","{$obj->method()}"(v1 may limit to variables/array offsets)Scope
PHPCfg\OperandCompiler::compileExprJitStringConcat/TYPE_CONCAT)test/compliance/cases/language/encapsed_string.phptlib/Lint/UnsupportedRegistry.phpuntil implemented (Lint: Register Phase-2 blockers in UnsupportedRegistry (ternary, .=, break) #258)Acceptance criteria
Identical output in
bin/vm.phpandbin/jit.php.Verification (local only)
./script/ci-local.sh --filter encapsed docker run --rm -v "$(pwd):/compiler" -w /compiler php-compiler:22.04-dev \ ./script/ci-local.sh --filter encapsedNo GitHub Actions required.
Dependencies
.=(related string building)Related