Skip to content

Fix serialization of array values in query string parameters (2.8 backport)#47

Open
aivus wants to merge 1 commit into
v2.8.xfrom
array-query-params-v2.8.x
Open

Fix serialization of array values in query string parameters (2.8 backport)#47
aivus wants to merge 1 commit into
v2.8.xfrom
array-query-params-v2.8.x

Conversation

@aivus

@aivus aivus commented Jul 7, 2026

Copy link
Copy Markdown
Member

Backport of #46 to the 2.8 release line (branch v2.8.x, cut from tag v2.8.2) for a v2.8.3 patch release.

Problem

RequestFactory::getRequestUri() substitutes every query placeholder with urlencode((string)$value). When a request DTO getter returns an array, the string cast produces the literal value Array in the request URI, so array query parameters cannot be sent at all.

Fix

  • Array values for query placeholders are serialized with http_build_query(), expanding to bracket syntax (categories%5B0%5D=a&categories%5B1%5D=b) that PHP servers parse back into arrays.
  • Empty arrays drop the parameter; normalizeQueryString() cleans up leftover separators.
  • Scalar and null values keep the exact previous behavior.

The diff is identical to #46 (Service/Request/RequestFactory.php and its test are byte-identical between master and v2.8.2).

Tests

Same new RequestFactoryTest cases as #46. Full suite: 95 tests, 255 assertions, green on PHP 7.4.

🤖 Generated with Claude Code

RequestFactory cast every query placeholder value to string, so an
array value produced the literal "Array" in the request URI. Serialize
arrays with http_build_query() instead, expanding them to bracket
syntax (param[0]=a&param[1]=b). Empty arrays drop the parameter
entirely, with leftover query separators cleaned up.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant