You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
lib/Web/Superglobals.php sets PHP_SELF and SCRIPT_NAME but not SCRIPT_FILENAME — the absolute path to the script being executed. Front controllers and include resolution in #54 / #210 expect this CGI variable:
MiniWebApp (#246) and #296DOCUMENT_ROOT both assume standard CGI meta vars.
Goal
Populate $_SERVER['SCRIPT_FILENAME'] in VM serve, phpc run -q/-p, and AOT runtime refresh to the resolved filesystem path of the entry script (not the request URI).
Problem
lib/Web/Superglobals.phpsetsPHP_SELFandSCRIPT_NAMEbut notSCRIPT_FILENAME— the absolute path to the script being executed. Front controllers andincluderesolution in #54 / #210 expect this CGI variable:MiniWebApp (#246) and #296
DOCUMENT_ROOTboth assume standard CGI meta vars.Goal
Populate
$_SERVER['SCRIPT_FILENAME']in VM serve,phpc run -q/-p, and AOT runtime refresh to the resolved filesystem path of the entry script (not the request URI).Implementation hints
Superglobals::populateFromEnvironment()— accept optional$scriptFilenameargument; default fromSCRIPT_NAME+ docroot join whenDOCUMENT_ROOTis set (Web: $_SERVER['DOCUMENT_ROOT'] for docroot-relative paths #296).DevServer— passrealpath($docroot . $path)after index resolution (Web: DevServer default document (index.php) instead of hard-coded example.php #254).lib/AOT/runtime/superglobals_refresh.calongsidePHP_SELF(see existingset_string_keyforSCRIPT_NAME).test/unit/Web/SuperglobalsTest.php;ServeTestassertsSCRIPT_FILENAMEends withindex.phporexample.php.Acceptance criteria
Prints absolute path to
example.php(suffix match).docker run --rm -v "$(pwd):/compiler" -w /compiler php-compiler:22.04-dev \ ./script/ci-local.sh --filter SuperglobalsNew/updated tests pass.
Verification (local / Docker only)
Do not require GitHub Actions.
Dependencies
DOCUMENT_ROOT(path join semantics)Related
__FILE__/__DIR__magic constants