Skip to content

Testing: ServeTest POST form via phpc serve (#248) - #345

Merged
PurHur merged 1 commit into
masterfrom
issue-248-serve-post-integration
May 20, 2026
Merged

Testing: ServeTest POST form via phpc serve (#248)#345
PurHur merged 1 commit into
masterfrom
issue-248-serve-post-integration

Conversation

@PurHur

@PurHur PurHur commented May 20, 2026

Copy link
Copy Markdown
Owner

Summary

  • Add ServeTest::testPostFormUrlencoded proving phpc serve populates $_POST from application/x-www-form-urlencoded bodies.
  • Add ServeAotTest::testServeAotPostFormUrlencoded and testServeAotHttpResponseCode404SetsStatusLine for the AOT serve path.
  • Fix HashTable::rehash() collision chaining (VM serve hung after ~8 $_SERVER keys when CONTENT_LENGTH was set).
  • Harden DevServer::readRequest() to delimit headers via \r\n\r\n and read bodies by Content-Length.

Test plan

  • php vendor/bin/phpunit test/real/ServeTest.php (19 tests) in php-compiler:22.04-dev
  • New POST/404 tests in ServeAotTest (filter) in Docker
  • HashTableTest::testAddManyStringKeysIncludingContentLength
  • DevServerHeadersTest::testReadRequestPostBodyWithoutTrailingNewline

Closes #248. Also closes #281 and #285.

Made with Cursor

ServeTest and ServeAotTest now assert urlencoded POST bodies reach $_POST
via phpc serve and phpc serve --aot. DevServer readRequest parses bodies
without requiring a trailing newline. HashTable::rehash() linked collision
chains correctly so populating eight $_SERVER keys no longer hangs on
CONTENT_LENGTH (VM serve POST was timing out).

Closes #248. Also covers #281 (AOT 404 status) and #285 (AOT POST form).

Co-authored-by: Cursor <cursoragent@cursor.com>
@PurHur
PurHur merged commit 768536f into master May 20, 2026
@PurHur
PurHur deleted the issue-248-serve-post-integration branch May 20, 2026 12:45
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.

Testing: ServeTest and ServeAotTest assert http_response_code(404) status line Testing: ServeTest POST form submission via phpc serve

1 participant