AOT: deferred header() flush uses write(2) before body (#634) - #36154
Merged
Conversation
printf(3) stayed in the stdio buffer while echo used write(2), so CGI Status/Content-Type appeared after the JSON body. Flush now uses write, skips CLI runs without REQUEST_METHOD, avoids marking flushed on empty no-ops, and invalidates the LLVM header mirror on header_remove(). Co-authored-by: Cursor <cursoragent@cursor.com>
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()+echo json_encode(...)web fixtures:__phpc_response_headers_flushnow emits Status/header lines withwrite(2)instead ofprintf(3), so deferred headers are not stuck in the stdio buffer while body output uses directwrite(2).getenv('REQUEST_METHOD')(CLIheaders_listcases stay quiet).header_remove()so removed lines are not replayed.php-src reference:
ext/standard/head.c(sapi header emit before body).Closes #634
Test plan
Not covered: full
AotTestheader filter (some cases likesetcookie_headers_listsegfault on master too), differential sweep, self-host gates.Made with Cursor