Skip to content

Add header() for VM web scripts - #24

Merged
PurHur merged 1 commit into
masterfrom
feat/header-web-response
May 18, 2026
Merged

PurHur merged 1 commit into
masterfrom
feat/header-web-response

Conversation

@PurHur

@PurHur PurHur commented May 18, 2026

Copy link
Copy Markdown
Owner

Summary

  • Implement header() in the VM stdlib so compiled web-style scripts can set Content-Type and other HTTP headers before echoing HTML.
  • Add PHPT coverage under test/real and test/compliance.
  • Update examples/001-SimpleWeb to send Content-Type: text/html; charset=UTF-8.
  • Bootstrap removed Yay tokenizer constants on PHP 8+ and fix ${var} deprecation in src/cli.php so local VM runs do not emit output before header().

Test plan

  • phpunit test/real/RealWorldTest.php (24 tests)
  • phpunit test/compliance/VMTest.php (101 tests)
  • phpunit test/unit/ (16 tests)
  • Manual: php bin/vm.php -q 'name=World' examples/001-SimpleWeb/example.php

Made with Cursor

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>
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.

1 participant