Skip to content

AOT: Router render* void methods — template include must emit stdout (#764) #776

@PurHur

Description

@PurHur

Problem

examples/003-MiniWebApp/src/Router.php uses : void render methods that end with a literal include of layout templates:

private function renderHome(): void
{
    $title = 'Home';
    include __DIR__ . '/../templates/home.php';
}

#752 ✅ links the project; #764 tracks empty stdout when running .phpc/bin/app. VM/JIT serve prints HTML — the gap is native execute through void methods + nested includes.

#739 covers method_include_void.phpt fixture; this issue tracks the Router-shaped integration path.

Goal

Native binary stdout contains layout HTML (e.g. app_name from config.php) for:

  • QUERY_STRING=route=home
  • PATH_INFO=/hello + name=Dev

Implementation hints

Layer Files Notes
JIT include lib/JIT.php IncludeHelper, lib/JIT/Context.php Nested compile-time inlining depth (#568 history)
AOT lib/AOT/ Ensure included template TU is linked; echo/buffer not dropped after void return
Void returns #205 : void must not strip trailing include side effects
Typed props #767 private array $config on Router
Fixture test/fixtures/aot/cases/method_include_void.phpt Green before full 003 (#739)
Test #747 / #485 Project-level acceptance

Reproduce

composer install && ./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 >0; currently 0 (#764)

Docker (tar copy on empty bind-mount):

./script/docker-ci-local.sh --filter method_include_void

Acceptance criteria

Dependencies

Verification

Local/Docker only — ./script/ci-local.sh --filter MiniWebAppAotExecuteTest when #747 exists.

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