Skip to content

HTTP mock: parse query and form parameters the way Symfony encodes them #106

Open

Description

@temp

Part of #100. Line numbers refer to branch chore/php-8.4-dependabot (#98). Verified = reproduced, suspected = from reading the code.

Several query and form values are parsed differently from what Symfony actually sends. Fixing this changes which mocks match, so it is planned for 8.0.

  • explode('=') has no limit, so ?t=YQ== is parsed as YQ and base64 cursors never match (RealRequestFactory.php:157). Verified.
  • Symfony's query option encodes arrays as ids[0]=1&ids[1]=2 and filter[a]=1. These are parsed into flat keys, so none of these ever match: queryParam('ids[]', …), queryParam('ids', [...]), queryParam('filter', [...]) (RealRequestFactory.php:147-178). Verified.
  • queryParam('ids[]', ['1', '2']) doesn't match even ?ids[]=1&ids[]=2 (Matcher/QueryParamMatcher.php:58). Verified.
  • Form bodies have the same problems: t=YQ== is truncated, and array fields become tags[0], so requestParam('tags[]', …) never matches (RealRequestFactory.php:83-88). Verified.

Breaking: mocks written against the current parsing, e.g. queryParam('t', 'YQ'), stop matching.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions