Repository navigation
Conversation
When the PHP arg_separator.output option is not "&" (e.g. it is set to "&"), http_build_query() joins the encoded fields with it, so an array body is sent as "key=value&other=second" and the receiving end sees the fields "key" and "amp;other". This breaks any API called with array data through the Curl, Socket or Stream transports, for example Google's reCAPTCHA siteverify, which then answers "invalid-input-response" because it never receives a "response" field. Pass "&" to http_build_query() in all three transports, and add a test that posts two fields with arg_separator.output set to "&". This is the framework counterpart of joomla/joomla-cms#43452, which makes the same change to the CMS's own transports. 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.
When the PHP
arg_separator.outputoption is not&(e.g. it is set to&),http_build_query()joins the encoded fields with it. An array body passed to the Curl, Socket or Stream transport is then sent askey=value&other=second, and the receiving end sees the fieldskeyandamp;other.This is easily seen with Google's reCAPTCHA: Joomla 6's
Joomla\CMS\Captcha\Google\HttpBridgePostRequestMethodbuilds its client withJoomla\Http\HttpFactory, so it goes through these transports, and siteverify answersinvalid-input-responseto every submission because it never receives aresponsefield.This is the framework counterpart of joomla/joomla-cms#43452, which makes the same change to the CMS's own
libraries/src/Http/Transport/*classes. That PR alone does not fix code that uses the framework transports.Summary of Changes
'&'as the separator tohttp_build_query()inTransport\Curl,Transport\SocketandTransport\Stream.TransportTest::testRequestPostIgnoresArgSeparatorOutput, which posts two fields witharg_separator.outputset to&through each transport and checks both arrive under their own names.Testing Instructions
Run the unit tests with the stub server, as CI does:
Actual result BEFORE applying this Pull Request
The new test fails for all three transports: the stub receives
amp;otherinstead ofother.Expected result AFTER applying this Pull Request
The new test passes for all three transports (full suite: 51 tests OK; phpcs clean).
🤖 Generated with Claude Code