Skip to content

Commit

Permalink
Remove lorispath from PSR7 request (#9055)
Browse files Browse the repository at this point in the history
Removes lorispath from the PSR7 request's query parameters and uri query string (both must be updated separately).

Resolves #9049
  • Loading branch information
maximemulder authored Feb 27, 2024
1 parent b2e5c01 commit a55cb25
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions htdocs/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,24 @@

$serverrequest = \Laminas\Diactoros\ServerRequestFactory::fromGlobals();

// Remove the lorispath from the URI query parameters.
// Both the request query parameters and the URI query string must be updated.
$params = $serverrequest->getQueryParams();
unset($params['lorispath']);
$serverrequest = $serverrequest->withQueryParams($params);

$query = implode(
"&",
array_map(
fn ($key, $value) => $key . "=" . $value,
array_keys($params),
$params
)
);

$uri = $serverrequest->getUri();
$serverrequest = $serverrequest->withUri($uri->withQuery($query));

// Now that we've created the ServerRequest, handle it.
$factory = \NDB_Factory::singleton();
$user = $factory->user();
Expand Down

0 comments on commit a55cb25

Please # to comment.