diff options
author | Carl Schwan <carl@carlschwan.eu> | 2022-04-19 14:51:34 +0300 |
---|---|---|
committer | Carl Schwan <carl@carlschwan.eu> | 2022-04-19 15:37:55 +0300 |
commit | 5d821064ae75187d404e0242478cd0b2e09b24f3 (patch) | |
tree | edea4afd1dfe2dabeef0d5218e1b0b3ab6e38a12 | |
parent | e21fb22b9e53d132b36b5bacc48f2ff17407a5ca (diff) |
Don't sort router parameter for caching purposefeat/consistent-url
Otherwise the order of the parameters given to the router is not
consitent with the one that the API user gives.
Signed-off-by: Carl Schwan <carl@carlschwan.eu>
-rw-r--r-- | lib/private/Route/CachingRouter.php | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/private/Route/CachingRouter.php b/lib/private/Route/CachingRouter.php index f65060e710b..38c21bfb2f5 100644 --- a/lib/private/Route/CachingRouter.php +++ b/lib/private/Route/CachingRouter.php @@ -49,8 +49,9 @@ class CachingRouter extends Router { * @return string */ public function generate($name, $parameters = [], $absolute = false) { - asort($parameters); - $key = $this->context->getHost() . '#' . $this->context->getBaseUrl() . $name . sha1(json_encode($parameters)) . (int)$absolute; + $sortedParameters = $parameters; + asort($sortedParameters); + $key = $this->context->getHost() . '#' . $this->context->getBaseUrl() . $name . sha1(json_encode($sortedParameters)) . (int)$absolute; $cachedKey = $this->cache->get($key); if ($cachedKey) { return $cachedKey; |