Repository navigation
Conversation
Client: php Match the generated handler signatures, serve the tutorial through the PHP built-in HTTP server, and send a valid Content-Type header. Track the actual generated processor in the tutorial make target. Run the tutorial client against both HTTP entry points in the PHP CI matrix and verify RPC output, including the declared exception. Generated-by: Codex (GPT-6)
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The PHP generation target can remain out of date when unchanged output timestamps are preserved, causing repeated compilation and a failing make -q check unless the target is touched or a generation stamp is used.
1 open issue
What changed in this PR
Restores the PHP tutorial’s HTTP workflow by aligning the server with generated interfaces and replacing the Python 2 launcher.
Changes:
- Corrects handler signatures, removes the web entry point’s shebang, and fixes the response header.
- Uses PHP’s built-in server and updates generated-file dependencies.
- Adds end-to-end coverage for both server entry points in the existing PHP CI matrix.
| File | Description |
|---|---|
tutorial/php/test_tutorial.py |
Adds HTTP client tests for both server entry points. |
tutorial/php/runserver.py |
Replaces the Python 2 server with a Python 3 launcher for PHP. |
tutorial/php/PhpServer.php |
Fixes startup compatibility and the HTTP response header. |
tutorial/php/Makefile.am |
Updates generation dependencies, launcher invocation, and test distribution. |
.github/workflows/build.yml |
Adds tutorial generation and end-to-end checks to PHP CI. |
Review effort: Balanced
Comment on lines
+20
to
21
| gen-php/tutorial/CalculatorProcessor.php: $(top_srcdir)/tutorial/tutorial.thrift $(top_srcdir)/tutorial/shared.thrift | ||
| $(THRIFT) --gen php:server -r $< |
Contributor
Author
|
Closing as a duplicate of #4158, which addresses the same THRIFT-6498 tutorial server issues and was opened while this change was being prepared. The end-to-end tutorial tests and CI coverage in this branch remain available for reuse. |
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.

Jira: THRIFT-6498
The PHP tutorial server fails to load against the generated typed interfaces, and its Python 2 launcher no longer runs on Python 3. Even after startup is repaired, the malformed Content-Type header prevents the tutorial HTTP client from reading the response.
This change matches all five handler signatures to the generated interfaces, removes the web entry point's shebang, fixes the response header, and makes runserver.py launch PHP's built-in server on localhost:8080. The make target now tracks CalculatorProcessor.php and both IDL inputs instead of the obsolete Calculator.php filename.
A new end-to-end test runs the existing tutorial client against both php -S and runserver.py, checking ping, addition, the declared division-by-zero exception, subtraction, and getStruct output. It runs in the existing PHP 8.2–8.5 CI matrix. The test is included in EXTRA_DIST.
Validation:
Before the fix, both new tests fail on the namespace/shebang and Python 2 import errors.
After the fix, both tests pass on PHP 8.4.21 / Python 3.12 and PHP 8.5.11 / Python 3.13.
Built the current 0.26.0 compiler; clean tutorial generation, the subsequent make up-to-date check, PHP syntax checks, changed-file codespell, and git diff --check pass.
Repository-wide make style was run on a separate copy because it rewrites files. It fails on existing findings outside this change, including listin/siz in test/cpp/src/TestClient.cpp and ddress in test/crossrunner/report.py.
JIRA ticket exists and is assigned to sveneld.
PR title starts with the JIRA ticket ID.
One commit for this issue.
Compatibility considered: the launcher now serves locally through PHP; the tutorial endpoint and client command remain the same.
Generated-by: Codex (GPT-6)