Add header() for VM web scripts - #24
Merged
Merged
Conversation
Web pages need Content-Type and other HTTP headers before body output. Implement header() in the VM stdlib (delegating to PHP), add PHPT coverage, set charset in the SimpleWeb example, fix cli.php string interpolation for PHP 8.2, and define removed Yay tokenizer constants so the compiler runs on PHP 8+ with extensions enabled. Co-authored-by: Cursor <cursoragent@cursor.com>
This was referenced Sep 2, 2026
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
header()in the VM stdlib so compiled web-style scripts can setContent-Typeand other HTTP headers before echoing HTML.test/realandtest/compliance.examples/001-SimpleWebto sendContent-Type: text/html; charset=UTF-8.${var}deprecation insrc/cli.phpso local VM runs do not emit output beforeheader().Test plan
phpunit test/real/RealWorldTest.php(24 tests)phpunit test/compliance/VMTest.php(101 tests)phpunit test/unit/(16 tests)php bin/vm.php -q 'name=World' examples/001-SimpleWeb/example.phpMade with Cursor