Problem
#707 shipped runtime __DIR__ / __FILE__ on the include stack (VM ScriptStack, JIT per-unit path). docs/capabilities-syntax.md still lists __LINE__ as no — logging, asserts, and error pages in multi-file apps need the line of the currently executing script, not only parse-time folding.
examples/003-MiniWebApp does not require __LINE__ for v1, but the umbrella #85 remains open until this slice lands.
Scope
| Mode |
Behavior |
| VM |
__LINE__ reflects current script on include stack (push/pop with TYPE_INCLUDE) |
| JIT |
Per-compile-unit line table or runtime opcode (match VM) |
| AOT |
Compile-time constant OK for single-file; document when bundled sources fold |
Implementation hints
| Step |
Files |
Notes |
| VM stack |
lib/VM.php |
Extend script stack pushed on TYPE_INCLUDE with line from Runtime::parse() |
| Compiler |
lib/Compiler.php |
Expr_MagicConst / TYPE_MAGIC_LINE (mirror #707 TYPE_MAGIC_DIR) |
| JIT |
lib/JIT.php |
Per-block line from php-cfg getLine() at magic site |
| Lint |
lib/Lint/UnsupportedRegistry.php |
Remove block when runtime path green |
| Docs |
script/capability-syntax-lib.php |
Flip __LINE__ row to yes (#706 generator) |
Acceptance criteria
./script/ci-fast.sh --filter magic_line
docker run --rm -v "$(pwd):/compiler" -w /compiler php-compiler:22.04-dev \
./script/ci-fast.sh --filter magic_line
Dependencies
Verification
Local/Docker only — not GitHub Actions.
Links
Problem
#707 shipped runtime
__DIR__/__FILE__on the include stack (VMScriptStack, JIT per-unit path).docs/capabilities-syntax.mdstill lists__LINE__as no — logging, asserts, and error pages in multi-file apps need the line of the currently executing script, not only parse-time folding.examples/003-MiniWebAppdoes not require__LINE__for v1, but the umbrella #85 remains open until this slice lands.Scope
__LINE__reflects current script on include stack (push/pop withTYPE_INCLUDE)Implementation hints
lib/VM.phpTYPE_INCLUDEwithlinefromRuntime::parse()lib/Compiler.phpExpr_MagicConst/TYPE_MAGIC_LINE(mirror #707TYPE_MAGIC_DIR)lib/JIT.phpgetLine()at magic sitelib/Lint/UnsupportedRegistry.phpscript/capability-syntax-lib.php__LINE__row to yes (#706 generator)Acceptance criteria
./script/ci-fast.sh --filter magic_line docker run --rm -v "$(pwd):/compiler" -w /compiler php-compiler:22.04-dev \ ./script/ci-fast.sh --filter magic_linetest/compliance/cases/language/magic_line_include.phpt— helper returns__LINE__; main includes itphp script/capability-syntax.php --checkpasses after row updateDependencies
__DIR__/__FILE__runtime patternVerification
Local/Docker only — not GitHub Actions.
Links