Skip to content

Web: $_SERVER['SCRIPT_FILENAME'] for CGI routing and AOT (fixes #302)#316

Merged
PurHur merged 1 commit into
masterfrom
feat/web-script-filename-302
May 19, 2026
Merged

Web: $_SERVER['SCRIPT_FILENAME'] for CGI routing and AOT (fixes #302)#316
PurHur merged 1 commit into
masterfrom
feat/web-script-filename-302

Conversation

@PurHur
Copy link
Copy Markdown
Owner

@PurHur PurHur commented May 19, 2026

Summary

  • Populate $_SERVER['SCRIPT_FILENAME'] in Superglobals::populateServer() from SCRIPT_FILENAME env or DOCUMENT_ROOT + SCRIPT_NAME.
  • Set the variable in DevServer CGI env/putenv, bin/vm.php / bin/compile.php entry resolution, and AOT superglobals_refresh.c.
  • Register SCRIPT_FILENAME (and DOCUMENT_ROOT) as runtime-only $_SERVER keys in SuperglobalInit so AOT reads refreshed CGI values.

Test plan

  • SuperglobalsScriptFilenameTest (unit)
  • PhpcCliTest::testRunPopulatesScriptFilename
  • RuntimeSuperglobalRefreshTest::testScriptFilenameFromCgiEnvironment (Docker)
  • AOT/real .phpt fixtures added (web_script_filename.phpt)
  • Serve integration tests require loopback bind in Docker (skipped in harness when bind fails)

Closes #302

Made with Cursor

Expose the absolute entry script path in VM serve, phpc run, and AOT
superglobal refresh so front controllers can resolve includes from dirname().

Co-authored-by: Cursor <cursoragent@cursor.com>
@PurHur PurHur merged commit 4ea83f2 into master May 19, 2026
1 check failed
@PurHur PurHur deleted the feat/web-script-filename-302 branch May 19, 2026 17:52
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.

Web: $_SERVER['SCRIPT_FILENAME'] for CGI routing and includes

1 participant