diff --git a/lib/private/Route/CachingRouter.php b/lib/private/Route/CachingRouter.php index d6270dcf2c727451f88053da449ca2f4ad713494..063d389e98bcbbdcc63cdf2d0fe48a6f8b7f0ff6 100644 --- a/lib/private/Route/CachingRouter.php +++ b/lib/private/Route/CachingRouter.php @@ -50,8 +50,9 @@ class CachingRouter extends Router { public function generate($name, $parameters = array(), $absolute = false) { asort($parameters); $key = $this->context->getHost() . '#' . $this->context->getBaseUrl() . $name . sha1(json_encode($parameters)) . intval($absolute); - if ($this->cache->hasKey($key)) { - return $this->cache->get($key); + $cachedKey = $this->cache->get($key); + if ($cachedKey) { + return $cachedKey; } else { $url = parent::generate($name, $parameters, $absolute); $this->cache->set($key, $url, 3600); diff --git a/lib/public/icache.php b/lib/public/icache.php index 3319013ddfadc1a61280251079abda3671b56422..a1ce068d819d48ce4265100f9a70fc7b0ee941d2 100644 --- a/lib/public/icache.php +++ b/lib/public/icache.php @@ -60,6 +60,7 @@ interface ICache { * @param string $key * @return bool * @since 6.0.0 + * @deprecated 9.1.0 Directly read from GET to prevent race conditions */ public function hasKey($key);