Skip to content

Commit

Permalink
Merge branch '0.13' into 0.14
Browse files Browse the repository at this point in the history
  • Loading branch information
mcg-web committed Apr 29, 2021
2 parents 6c4d30f + 76d9443 commit d1ffb3b
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/Request/Parser.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,13 +86,14 @@ private function getParams(Request $request, array $data = []): array
static::PARAM_OPERATION_NAME => null,
];

// Keep a reference to the query-string
$qs = $request->query;
// Use all query parameters, since starting from Symfony 6 there will be an exception accessing array parameters
// via request->query->get(key), and another exception accessing non-array parameter via request->query->all(key)
$queryParameters = $request->query->all();

// Override request using query-string parameters
$query = $qs->has(static::PARAM_QUERY) ? $qs->get(static::PARAM_QUERY) : $data[static::PARAM_QUERY];
$variables = $qs->has(static::PARAM_VARIABLES) ? $qs->get(static::PARAM_VARIABLES) : $data[static::PARAM_VARIABLES];
$operationName = $qs->has(static::PARAM_OPERATION_NAME) ? $qs->get(static::PARAM_OPERATION_NAME) : $data[static::PARAM_OPERATION_NAME];
$query = $queryParameters[static::PARAM_QUERY] ?? $data[static::PARAM_QUERY];
$variables = $queryParameters[static::PARAM_VARIABLES] ?? $data[static::PARAM_VARIABLES];
$operationName = $queryParameters[static::PARAM_OPERATION_NAME] ?? $data[static::PARAM_OPERATION_NAME];

// `query` parameter is mandatory.
if (empty($query)) {
Expand Down

0 comments on commit d1ffb3b

Please sign in to comment.