From 00dfd2c8e1a63c47f20dce93e8e3e34dd1df3071 Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Wed, 11 Nov 2020 11:57:08 +0100 Subject: [PATCH] Fix lock file being parsed when not strictly needed, fixes #9452 --- src/Composer/Installer.php | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/Composer/Installer.php b/src/Composer/Installer.php index 0586e261c..7b1f893ae 100644 --- a/src/Composer/Installer.php +++ b/src/Composer/Installer.php @@ -360,8 +360,17 @@ class Installer $lockedRepository = null; - if ($this->locker->isLocked()) { - $lockedRepository = $this->locker->getLockedRepository(true); + try { + if ($this->locker->isLocked()) { + $lockedRepository = $this->locker->getLockedRepository(true); + } + } catch (\Seld\JsonLint\ParsingException $e) { + if ($this->updateAllowList || $this->updateMirrors) { + // in case we are doing a partial update or updating mirrors, the lock file is needed so we error + throw $e; + } + // otherwise, ignoring parse errors as the lock file will be regenerated from scratch when + // doing a full update } if ($this->updateAllowList) {