1
0
Fork 0

Avoid failing to write the lock file if a lock file is present but corrupt/conflicted

pull/4428/head
Jordi Boggiano 2015-09-17 14:45:50 +01:00
parent b4bd5774dc
commit 0cbf679f21
1 changed files with 7 additions and 1 deletions

View File

@ -21,6 +21,7 @@ use Composer\Package\Dumper\ArrayDumper;
use Composer\Package\Loader\ArrayLoader;
use Composer\Util\Git as GitUtil;
use Composer\IO\IOInterface;
use Seld\JsonLint\ParsingException;
/**
* Reads/writes project lockfile (composer.lock).
@ -286,7 +287,12 @@ class Locker
return false;
}
if (!$this->isLocked() || $lock !== $this->getLockData()) {
try {
$isLocked = $this->isLocked();
} catch (ParsingException $e) {
$isLocked = false;
}
if (!$isLocked || $lock !== $this->getLockData()) {
$this->lockFile->write($lock);
$this->lockDataCache = null;