Skip to content

AOT: MiniWebApp native binary CLI execute emits empty stdout (post-link) #764

@PurHur

Description

@PurHur

Problem

#752 closed and harness verify (batch 50, 2026-05-23) confirms phpc build --project examples/003-MiniWebApp exits 0 and writes .phpc/bin/app when vendor patches are applied.

Runtime parity is not there yet: executing the binary with the same CGI env as MiniWebAppVmCliTest / examples-web-smoke.sh returns exit 0 but empty stdout for home and hello routes.

# After build (Docker, patches applied):
cd examples/003-MiniWebApp
export QUERY_STRING=route=home REQUEST_METHOD=GET
./.phpc/bin/app   # exit 0, len=0

export PATH_INFO=/hello QUERY_STRING=name=Dev REQUEST_METHOD=GET
./.phpc/bin/app   # exit 0, no greeting

VM path (phpc serve / bin/vm.php) prints HTML — this is an AOT execute gap, not a link failure.

Goal

Native binary output matches VM for:

  • QUERY_STRING=route=home → HTML contains app_name from config.php
  • PATH_INFO=/hello + name=Dev → greeting string
  • POST /contact → thank-you template body

Scope

Implementation hints

Area Files Notes
Entry examples/003-MiniWebApp/public/index.php PATH_INFO + ?route= fallback
Router src/Router.php : void methods, include templates
AOT runtime lib/AOT/, lib/VM.php superglobal refresh Compare with #49 / #665 001 green
Includes deploy tree / compile-time graph #452 includes[] order
Test test/unit/MiniWebAppAotExecuteTest.php (#747) runBinaryWithCgiEnv() helper

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 byte count; currently 0.

Acceptance criteria

Dependencies

Verification

Local/Docker only — ./script/docker-ci-local.sh --filter MiniWebAppAotExecuteTest (once added). No 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