You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
include followed by include_once of the same file runs it twice #407
Known-bug repro: tests/aot/repro/wrong/include_once_after_include_runs_twice.php — bash tests/aot/xfail.sh -k include_once_after_include_runs_twice reports XFAIL while this is open and XPASS once it is fixed; then move the repro into tests/aot/cases/ and close this issue.
Findings from a first fix attempt (not a small bug):
The parser lowers all four include forms to __mc_require_value and drops the _once distinction.
At top level, an include of a file that is a compile unit is a no-op because its code already ran when the binary started. Inside functions, a file that is not a compile unit is inlined at every include site (LowerExprs::lowerScopedInclude), so include followed by include_once of the same file runs it twice. Confirmed with a file that exists at build time.
get_included_files() is hard-coded to the entry script.
The repro in tests/aot/repro/wrong/include_once_after_include_runs_twice.php writes the included file at run time with an echo in it; a native binary has no interpreter, so it prints nothing at all (only pure-data return files are evaluated for runtime-written files). That repro cannot pass in any native implementation and should be rewritten around a build-time file.
A fix needs the _once flag carried from Parser.php into lowering, a per-file "included" guard on the scoped inline, and a real get_included_files().
Closing: the repro cannot work in an AOT binary. A file written at run time is never evaluated as PHP, so its echo never runs. Static include/require/include_once are inlined once at build time and the double run was not reproduced there. Reopen with a repro that uses a static file if it still shows up.
Activity
blacktrs commentedon Oct 24, 2026
Findings from a first fix attempt (not a small bug):
__mc_require_valueand drops the_oncedistinction.LowerExprs::lowerScopedInclude), soincludefollowed byinclude_onceof the same file runs it twice. Confirmed with a file that exists at build time.get_included_files()is hard-coded to the entry script.tests/aot/repro/wrong/include_once_after_include_runs_twice.phpwrites the included file at run time with anechoin it; a native binary has no interpreter, so it prints nothing at all (only pure-datareturnfiles are evaluated for runtime-written files). That repro cannot pass in any native implementation and should be rewritten around a build-time file.A fix needs the
_onceflag carried fromParser.phpinto lowering, a per-file "included" guard on the scoped inline, and a realget_included_files().blacktrs commentedon Oct 24, 2026
Closing: the repro cannot work in an AOT binary. A file written at run time is never evaluated as PHP, so its echo never runs. Static include/require/include_once are inlined once at build time and the double run was not reproduced there. Reopen with a repro that uses a static file if it still shows up.
Issue sweep: 31 bugs across front end, coercion, calls and class reso…