Skip to content

Commit 5d82106

Browse files
committed
Don't sort router parameter for caching purpose
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>
1 parent e21fb22 commit 5d82106

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

lib/private/Route/CachingRouter.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,9 @@ public function __construct($cache, LoggerInterface $logger) {
4949
* @return string
5050
*/
5151
public function generate($name, $parameters = [], $absolute = false) {
52-
asort($parameters);
53-
$key = $this->context->getHost() . '#' . $this->context->getBaseUrl() . $name . sha1(json_encode($parameters)) . (int)$absolute;
52+
$sortedParameters = $parameters;
53+
asort($sortedParameters);
54+
$key = $this->context->getHost() . '#' . $this->context->getBaseUrl() . $name . sha1(json_encode($sortedParameters)) . (int)$absolute;
5455
$cachedKey = $this->cache->get($key);
5556
if ($cachedKey) {
5657
return $cachedKey;

0 commit comments

Comments
 (0)