From cac2d076b1d92be641ddb6a0476a37ddd57f4ee9 Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Wed, 27 Apr 2022 21:30:21 +0200 Subject: [PATCH] Fix corrupt caches for svn driver, fixes #10751 --- src/Composer/Repository/Vcs/SvnDriver.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/Composer/Repository/Vcs/SvnDriver.php b/src/Composer/Repository/Vcs/SvnDriver.php index af29720a2..579a46bea 100644 --- a/src/Composer/Repository/Vcs/SvnDriver.php +++ b/src/Composer/Repository/Vcs/SvnDriver.php @@ -137,6 +137,13 @@ class SvnDriver extends VcsDriver { if (!isset($this->infoCache[$identifier])) { if ($this->shouldCache($identifier) && $res = $this->cache->read($identifier.'.json')) { + // old cache files had '' stored instead of null due to af3783b5f40bae32a23e353eaf0a00c9b8ce82e2, so we make sure here that we always return null or array + // and fix outdated invalid cache files + if ($res === '""') { + $res = 'null'; + $this->cache->write($identifier.'.json', json_encode(null)); + } + return $this->infoCache[$identifier] = JsonFile::parseJson($res); }