Skip to content

JIT project: fix CLI relative script paths for MiniWebApp entry (#1770) - #3334

Merged
PurHur merged 1 commit into
masterfrom
agent/issue-1770-miniwebapp-jit-project
May 30, 2026
Merged

JIT project: fix CLI relative script paths for MiniWebApp entry (#1770)#3334
PurHur merged 1 commit into
masterfrom
agent/issue-1770-miniwebapp-jit-project

Conversation

@PurHur

@PurHur PurHur commented May 29, 2026

Copy link
Copy Markdown
Owner

Summary

  • Preserve PHP_COMPILER_CLI_INVOCATION_CWD before bin/*.php chdir to the repo root so relative script paths resolve correctly (e.g. index.php from examples/003-MiniWebApp/public/).
  • Resolve user script and --include paths in src/cli_driver.php via php_compiler_cli_resolve_user_path().
  • Add CliInvocationCwdTest; MiniWebAppVmCliTest is green again in Docker.

Closes #1770 (partial — VM/project entry path; full JIT project gate still blocked on MCJIT probe #98 and follow-on JIT lowering).

php-src reference

N/A (CLI integration). Zend semantics unchanged; this matches how PHP CLI resolves paths relative to the shell cwd.

Verification

./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && vendor/bin/phpunit --filter "MiniWebAppVmCliTest|CliInvocationCwdTest"'

# Manual repro (was: Could not open file index.php)
./script/docker-exec.sh -- bash -lc '
  source script/php-env.sh
  cd examples/003-MiniWebApp/public
  export QUERY_STRING=route=home REQUEST_METHOD=GET SCRIPT_NAME=/index.php
  php ../../../bin/vm.php index.php | head -5
'

MiniWebAppJitProjectTest still skips when script/jit-runtime-probe.php fails (MCJIT segfault in container, #98).

Test plan

  • MiniWebAppVmCliTest (4 tests)
  • CliInvocationCwdTest
  • MINIWEBAPP_JIT_PROJECT_GATE=1 — blocked on LLVM MCJIT probe in harness Docker image

Made with Cursor

bin/vm.php and bin/jit.php chdir to the repo root before argv parsing,
which broke relative paths like `index.php` when invoked from
examples/003-MiniWebApp/public (MiniWebApp VM/JIT project entry).

Preserve PHP_COMPILER_CLI_INVOCATION_CWD before chdir and resolve user
script/include paths against it in cli_driver. MiniWebAppVmCliTest and a
new CliInvocationCwdTest guard the behavior.

JIT project tests still skip when MCJIT probe fails (LLVM execute
segfault in container, #98); next step is project-graph JIT once probe is green.

Co-authored-by: Cursor <cursoragent@cursor.com>
@PurHur
PurHur merged commit 4bd4957 into master May 30, 2026
@PurHur
PurHur deleted the agent/issue-1770-miniwebapp-jit-project branch May 30, 2026 04:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

JIT: Project include lowering for 003-MiniWebApp (phpc serve --jit blocked on #475)

1 participant