Skip to content

AOT: Project entry require-as-expression bootstrap (config.php → Router) (#764) #783

@PurHur

Description

@PurHur

Problem

examples/003-MiniWebApp/public/index.php bootstraps the app with require-as-expression and a separate class load before dispatch:

$config = require __DIR__ . '/../config.php';
require __DIR__ . '/../src/Router.php';
$router = new Router($config);
$router->dispatch($method, $route);

#752 ✅ links the project; #764 tracks empty stdout on native execute. VM/phpc serve prints HTML — the gap is specific to AOT runtime through the compiled entry graph.

This path is distinct from #776 (void render* + template include) and #739 (isolated void+include fixture): if the entry TU mishandles require return values or class constructor wiring, dispatch may run with an empty config or never reach template output.

Goal

Native .phpc/bin/app executes the same bootstrap as VM:

Scope

Implementation hints

Area Files Notes
Entry examples/003-MiniWebApp/public/index.php PATH_INFO + ?route= fallback
Manifest examples/003-MiniWebApp/phpc.json includes: Router.php, config.php
AOT compile lib/AOT/, lib/Compiler.php Compare VM path for require expr
Compare examples/001-SimpleWeb flat entry — green reference

Reproduce (local / Docker)

make docker-build-22
docker run --rm -i -w /compiler php-compiler:22.04-dev bash -lc '
  tar -xf - && composer install -q && ./script/apply-patches.sh
  php bin/phpc.php build --project examples/003-MiniWebApp
  cd examples/003-MiniWebApp
  QUERY_STRING=route=home REQUEST_METHOD=GET ./.phpc/bin/app | wc -c
'

Expect non-zero bytes; currently 0 (batch 52 harness verify).

Acceptance criteria

Dependencies

Verification

Local/Docker only — ./script/docker-ci-local.sh, make test-docker. Do not require GitHub Actions.

Links

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions