Skip to content

Commit

Permalink
Add escaping of %-characters to prevent the Symfony router from attem…
Browse files Browse the repository at this point in the history
…pting to resolve them as service container parameters
  • Loading branch information
niels-nijens committed Jan 29, 2025
1 parent 51bab22 commit e709e3f
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/Routing/RouteLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,12 @@ private function addRouteContextForValidation(
}

if (isset($operation->requestBody->content->{'application/json'}->schema)) {
$openapiRouteContext[RouteContext::REQUEST_BODY_SCHEMA] = serialize($operation->requestBody->content->{'application/json'}->schema);
// Escape %-characters to prevent the router from interpreting them as service container parameters.
$openapiRouteContext[RouteContext::REQUEST_BODY_SCHEMA] = str_replace(
'%',
'%%',
serialize($operation->requestBody->content->{'application/json'}->schema)
);
}

if (isset($operation->requestBody->content->{'application/json'})) {
Expand Down

0 comments on commit e709e3f

Please sign in to comment.