Category
language · php-src-strict
Problem
Scripts that build paths with __DIR__ / __FILE__ for highlight_file() / highlight_string() fail at compile time:
parseAndCompile failure: Unknown variable op found: Expr_MagicScriptConst
Zend compiles and runs these patterns (common in debug tooling and self-host tests).
php-src reference
Repro (failure today — verified 2026-06-19)
test/repro/maintainer_gap_highlight_file_bool.php:
<?php
$sample = __DIR__ . '/highlight_sample.php';
$fileHtml = highlight_file($sample, true);
echo gettype($fileHtml), "\n";
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh
php bin/vm.php test/repro/maintainer_gap_highlight_file_bool.php'
# parseAndCompile failure: Unknown variable op found: Expr_MagicScriptConst
Also fails when highlight_string('<?php echo 1; ?>', true) works but a subsequent highlight_file(__DIR__ . '/x.php', true) does not.
Scope (PHP-in-PHP)
| Layer |
Path |
| Compiler |
lib/Compiler.php — lower Op\Expr\MagicScriptConst in concat / call arg contexts |
| AST |
lib/Ast/ if php-cfg overlay gaps |
| Builtins |
ext/standard/highlight_file.php, highlight_string.php (runtime OK once compile succeeds) |
| Tests |
test/compliance/cases/stdlib/highlight_file_dir_concat.phpt |
Done when
Related
Category
language· php-src-strictProblem
Scripts that build paths with
__DIR__/__FILE__forhighlight_file()/highlight_string()fail at compile time:Zend compiles and runs these patterns (common in debug tooling and self-host tests).
php-src reference
Zend/zend_compile.c— magic constants in concat / arg positionsext/standard/basic_functions.c—highlight_file,highlight_stringBootstrapPhpTypesMagicScriptConstPatchTest(Self-host M2/M0: php-types-magic-script-const patch drift — Expr_MagicScriptConst missing blocks link + spine #2826)Repro (failure today — verified 2026-06-19)
test/repro/maintainer_gap_highlight_file_bool.php:Also fails when
highlight_string('<?php echo 1; ?>', true)works but a subsequenthighlight_file(__DIR__ . '/x.php', true)does not.Scope (PHP-in-PHP)
lib/Compiler.php— lowerOp\Expr\MagicScriptConstin concat / call arg contextslib/Ast/if php-cfg overlay gapsext/standard/highlight_file.php,highlight_string.php(runtime OK once compile succeeds)test/compliance/cases/stdlib/highlight_file_dir_concat.phptDone when
boolean(orstringwhen sample exists) on VM__FILE__,__DIR__,__LINE__work in string concat passed to highlight builtins./script/ci-fast.sh --filter highlight_file_dir_concatgreenRelated