Skip to content

AOT: Runtime include() of deploy-root PHP via phpc_deploy_path() #623

@PurHur

Description

@PurHur

Problem

#585 / phpc_deploy_path() rewrite __DIR__ includes at AOT link time for bundled sources. #609 copies templates/ into dist/, but MiniWebApp still uses runtime include __DIR__ . '/../templates/layout.php' from Router methods.

Native binaries must resolve those includes against PHPC_DEPLOY_ROOT at request time (same as VM DeployRoot::resolve()), not only compile-time literal paths.

Today lib/AOT/ has no TYPE_INCLUDE lowering; template includes may break after phpc build --project even when #568 object model lands.

Goal

export PHPC_DEPLOY_ROOT=/var/www/miniwebapp-dist
./bin/app   # CGI env → home route renders layout.php from dist/templates/

VM + AOT: TYPE_INCLUDE with phpc_deploy_path() operand calls DeployRoot::resolve() or reads pre-copied trees under deploy root.

Implementation hints

Area Files Notes
VM lib/VM.php TYPE_INCLUDE Already resolves paths; ensure phpc_deploy_path() builtin matches deploy root
AOT lib/AOT/, lib/JIT/IncludeHelper.php Emit runtime include stub or callback into VM include path
Bundler lib/Web/SourceBundler.php Only rewrite includes marked for deploy; keep templates/ as runtime copies
Tests test/fixtures/aot/cases/deploy_include_template.phpt temp dist + PHPC_DEPLOY_ROOT
E2E #612 dist-layout smoke after deploy + include works

Acceptance criteria

docker run --rm -v "$(pwd):/compiler" -w /compiler php-compiler:22.04-dev \
  ./script/ci-local.sh --filter deploy_include

Fixture passes VM today; AOT case unskipped when #568 links MiniWebApp (or minimal class + include fixture first).

Dependencies

Verification

Local/Docker only — not GitHub Actions.

Links

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:webWeb / CGI / superglobalsenhancementNew feature or requestphase-3:aotPhase 3 – AOT deployment

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions