Repository navigation
Conversation
The stream transport merged the http options of PHP's default stream context with its own options into $contextOptions and then never used the result: the context is created from its own options only, and a context passed to fopen() replaces the default one. Remove the dead code and document that the default context is not used. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.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 of Changes
Stream::request()built$contextOptionsby merging thehttpoptions of PHP's default stream context (stream_context_get_default()) with the request options, and then never used it: the context forfopen()is created from$optionsalone, and a context passed tofopen()replaces the default context rather than being merged with it.This keeps the current behaviour (the default context is not used) and removes the dead code. The alternative, actually merging the default context's
httpoptions, would change behaviour in 4.x (a proxy or headers set globally withstream_context_set_default()would suddenly apply), so it was not done;transport.streamalready offers a way to pass such options.Testing Instructions
No behaviour change, so no new test. The existing stream transport tests pass unchanged. To confirm that PHP does not merge the default context:
Documentation Changes Required
docs/classes/TransportInterface.md, "Options": the stream transport does not use PHP's default stream context; usetransport.streaminstead.🤖 Generated with Claude Code