Skip to content

Web: $_SERVER['SERVER_PROTOCOL'] for dev server and AOT (closes #306) - #324

Merged
PurHur merged 2 commits into
masterfrom
issue-306-server-protocol
May 20, 2026
Merged

PurHur merged 2 commits into
masterfrom
issue-306-server-protocol

Conversation

@PurHur

@PurHur PurHur commented May 20, 2026

Copy link
Copy Markdown
Owner

Summary

  • Parse HTTP/x.y from the dev-server request line, pass it through putenv/CGI (SERVER_PROTOCOL), and populate VM $_SERVER plus AOT sg_SERVER (default HTTP/1.1 when unset).
  • Fix AOT correctness: add SERVER_PROTOCOL to RUNTIME_SERVER_KEYS so it is not compile-time baked, and name LLVM C-string globals with a php_cstr_ hash prefix so they cannot collide with libc getenv lookups.
  • Add PHPT fixtures (VM + AOT), ServeTest / ServeAotTest coverage, and refresh docs/bootstrap-inventory.md.

Test plan

  • docker run --rm -v "$(pwd):/compiler" -w /compiler php-compiler:22.04-dev vendor/bin/phpunit --group serve test/real/ServeTest.php --filter ServerProtocol
  • docker run --rm -v "$(pwd):/compiler" -w /compiler php-compiler:22.04-dev vendor/bin/phpunit --group llvm,serve test/real/ServeAotTest.php --filter ServerProtocol
  • php script/bootstrap-inventory.php --check and php script/capability-matrix.php --check (inside the same image via tarball pipe; bind-mount of this workspace was empty in the harness).

Closes #306.

Made with Cursor

PurHur and others added 2 commits May 20, 2026 08:26
Parse the request-line HTTP version in DevServer, mirror it via putenv/CGI
env, populate VM $_SERVER with a CGI default, and set sg_SERVER in the AOT
refresh. Treat SERVER_PROTOCOL as a runtime $_SERVER key (with hashed LLVM
C-string symbols) so AOT does not bake a compile-time value. Add PHPT and
serve integration coverage.

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>

# Conflicts:
#	docs/bootstrap-inventory.md
@PurHur
PurHur merged commit 60876e8 into master May 20, 2026
@PurHur
PurHur deleted the issue-306-server-protocol branch May 20, 2026 08:27
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['SERVER_PROTOCOL'] from HTTP request line

1 participant