From 9c8596e95b81f9d5ddcd7132ac0134b0ffed67e5 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Tue, 1 Apr 2014 15:43:27 +0200 Subject: [PATCH 1/3] Keep cached urls with different hostnames or baseurls seperate --- lib/private/route/cachingrouter.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/private/route/cachingrouter.php b/lib/private/route/cachingrouter.php index ad25372391..63bfd3e053 100644 --- a/lib/private/route/cachingrouter.php +++ b/lib/private/route/cachingrouter.php @@ -31,7 +31,7 @@ class CachingRouter extends Router { * @return string */ public function generate($name, $parameters = array(), $absolute = false) { - $key = $name . json_encode($parameters) . $absolute; + $key = $this->context->getHost() . $this->context->getBaseUrl() . $name . json_encode($parameters) . $absolute; if ($this->cache->hasKey($key)) { return $this->cache->get($key); } else { From 51fbf0bcbc2c3c68f7b4b36128304f4ab9df98e7 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Mon, 7 Apr 2014 13:27:18 +0200 Subject: [PATCH 2/3] add delimiter between host and baseurl --- lib/private/route/cachingrouter.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/private/route/cachingrouter.php b/lib/private/route/cachingrouter.php index 63bfd3e053..766c67c73a 100644 --- a/lib/private/route/cachingrouter.php +++ b/lib/private/route/cachingrouter.php @@ -31,7 +31,7 @@ class CachingRouter extends Router { * @return string */ public function generate($name, $parameters = array(), $absolute = false) { - $key = $this->context->getHost() . $this->context->getBaseUrl() . $name . json_encode($parameters) . $absolute; + $key = $this->context->getHost() . '#' . $this->context->getBaseUrl() . $name . json_encode($parameters) . $absolute; if ($this->cache->hasKey($key)) { return $this->cache->get($key); } else { From 7f77b08098426801bfede696a88671efc1f82d83 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Tue, 15 Apr 2014 15:48:02 +0200 Subject: [PATCH 3/3] Sort parameters and cast to int --- lib/private/route/cachingrouter.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/private/route/cachingrouter.php b/lib/private/route/cachingrouter.php index 766c67c73a..6412ceb041 100644 --- a/lib/private/route/cachingrouter.php +++ b/lib/private/route/cachingrouter.php @@ -31,7 +31,8 @@ class CachingRouter extends Router { * @return string */ public function generate($name, $parameters = array(), $absolute = false) { - $key = $this->context->getHost() . '#' . $this->context->getBaseUrl() . $name . json_encode($parameters) . $absolute; + sort($parameters); + $key = $this->context->getHost() . '#' . $this->context->getBaseUrl() . $name . json_encode($parameters) . intval($absolute); if ($this->cache->hasKey($key)) { return $this->cache->get($key); } else {