Avoid failing to write the lock file if a lock file is present but corrupt/conflicted
parent
b4bd5774dc
commit
0cbf679f21
|
@ -21,6 +21,7 @@ use Composer\Package\Dumper\ArrayDumper;
|
||||||
use Composer\Package\Loader\ArrayLoader;
|
use Composer\Package\Loader\ArrayLoader;
|
||||||
use Composer\Util\Git as GitUtil;
|
use Composer\Util\Git as GitUtil;
|
||||||
use Composer\IO\IOInterface;
|
use Composer\IO\IOInterface;
|
||||||
|
use Seld\JsonLint\ParsingException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reads/writes project lockfile (composer.lock).
|
* Reads/writes project lockfile (composer.lock).
|
||||||
|
@ -286,7 +287,12 @@ class Locker
|
||||||
return false;
|
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->lockFile->write($lock);
|
||||||
$this->lockDataCache = null;
|
$this->lockDataCache = null;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue