Skip to content

THRIFT-6023: Add HTTP transport support to PHP cross-tests#3515

Draft
sveneld wants to merge 6 commits into
apache:masterfrom
sveneld:THRIFT-6023
Draft

THRIFT-6023: Add HTTP transport support to PHP cross-tests#3515
sveneld wants to merge 6 commits into
apache:masterfrom
sveneld:THRIFT-6023

Conversation

@sveneld
Copy link
Copy Markdown
Contributor

@sveneld sveneld commented May 21, 2026

Adds HTTP transport support to the PHP entry of the cross-test matrix. PHP was the only major-language entry stuck on buffered/framed while Python, Go, Node, C++, Java, Lua, Dart, JS, D, and Haskell already declare http and verify HTTP interop.

ServerTestServer.php detects --transport=http in CLI mode and pcntl_exec()s into PHP's built-in web server (php -S 127.0.0.1:$port TestServer.php). The same script re-enters under SAPI cli-server, reads the request via TPhpStream from php://input, dispatches it through the existing processor, and writes the response to php://output. The original -d flags from the launcher cmdline (e.g. -dextension=thrift_protocol.so) are preserved by parsing /proc/self/cmdline, so the accel extension and sockets stay loaded under the spawned server too. The cross-runner's socket.connect_ex readiness probe works because php -S TCP-binds the port immediately.

ClientTestClient.php gains an if ($MODE == 'http') branch that uses TPsrHttpClient (added in THRIFT-6010) against http://127.0.0.1:$port/. TPsrHttpClient buffers internally, so no TBufferedTransport/TFramedTransport wrapping.

tests.json — adds "http" to PHP server and client transports; bumps client timeout from 6s → 10s to absorb HTTP overhead.

composer.json — adds guzzlehttp/guzzle: ^7.8 to require-dev so the PSR-18 auto-discovery in TPsrHttpClient resolves a concrete HTTP client at cross-test time.

JIRA: THRIFT-6023. Draft until cross-test CI validates the new php↔php / php↔py3 / php↔go HTTP matrix cells.

  • Did you create an Apache Jira ticket? (Request account here, not required for trivial changes)
  • If a ticket exists: Does your pull request title follow the pattern "THRIFT-NNNN: describe my issue"?
  • Did you squash your changes to a single commit? (not required, but preferred)
  • Did you do your best to avoid breaking changes? If one was needed, did you label the Jira ticket with "Breaking-Change"?
  • If your change does not involve any code, include [skip ci] anywhere in the commit message to free up build resources.

Client: php

PHP was excluded from the cross-test HTTP matrix while other languages
(Python, Go, Node, C++, Java, Lua, Dart, JS, D, Haskell) already declare
"http" in their cross-test transports and verify interop.

Server: TestServer.php detects --transport=http and pcntl_exec()s into
PHP's built-in web server (php -S 127.0.0.1:$port TestServer.php). The
same script re-enters under SAPI cli-server, reads the Thrift request via
TPhpStream from php://input, dispatches it through the existing processor,
and writes the response to php://output. Original -d flags from the
launcher cmdline are preserved so the accel/sockets extensions stay loaded.

Client: TestClient.php gains an --transport=http branch using
TPsrHttpClient (THRIFT-6010) against http://127.0.0.1:\$port/, with no
buffered/framed wrapper since TPsrHttpClient buffers internally.

tests.json: adds "http" to PHP server and client transports and raises the
client timeout from 6s to 10s to absorb HTTP overhead.

composer.json: adds guzzlehttp/guzzle ^7.8 to require-dev so the PSR-18
auto-discovery in TPsrHttpClient resolves at cross-test time.

Generated-by: Claude Opus 4.7
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant