diff --git a/src/Symfony/Component/HttpKernel/HttpCache/Store.php b/src/Symfony/Component/HttpKernel/HttpCache/Store.php index b57d4a774d5c2..f5574614b839a 100644 --- a/src/Symfony/Component/HttpKernel/HttpCache/Store.php +++ b/src/Symfony/Component/HttpKernel/HttpCache/Store.php @@ -317,14 +317,30 @@ private function getMetadata($key) /** * Purges data for the given URL. * + * This method purges both the HTTP and the HTTPS version of the cache entry. + * * @param string $url A URL * - * @return bool true if the URL exists and has been purged, false otherwise + * @return bool true if the URL exists with either HTTP or HTTPS scheme and has been purged, false otherwise */ public function purge($url) { - $key = $this->getCacheKey(Request::create($url)); + $http = preg_replace('#^https#', 'http', $url); + $https = preg_replace('#^http#', 'https', $url); + return $this->doPurge($http) || $this->doPurge($https); + } + + /** + * Purges data for the given URL. + * + * @param string $url A URL + * + * @return bool true if the URL exists and has been purged, false otherwise + */ + private function doPurge($url) + { + $key = $this->getCacheKey(Request::create($url)); if (isset($this->locks[$key])) { flock($this->locks[$key], LOCK_UN); fclose($this->locks[$key]);