JIT project: fix CLI relative script paths for MiniWebApp entry (#1770) - #3334
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
PHP_COMPILER_CLI_INVOCATION_CWDbeforebin/*.phpchdir to the repo root so relative script paths resolve correctly (e.g.index.phpfromexamples/003-MiniWebApp/public/).--includepaths insrc/cli_driver.phpviaphp_compiler_cli_resolve_user_path().CliInvocationCwdTest;MiniWebAppVmCliTestis 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
MiniWebAppJitProjectTeststill skips whenscript/jit-runtime-probe.phpfails (MCJIT segfault in container, #98).Test plan
MiniWebAppVmCliTest(4 tests)CliInvocationCwdTestMINIWEBAPP_JIT_PROJECT_GATE=1— blocked on LLVM MCJIT probe in harness Docker imageMade with Cursor