From b519d65bff28234df810ed52c8fbdf92b778daa0 Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Fri, 5 Apr 2013 15:01:18 +0200 Subject: [PATCH] Do not throw exception on install --dev with old lock files if composer.json has no require-dev --- src/Composer/Installer.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/Composer/Installer.php b/src/Composer/Installer.php index 132958622..c6d381ebc 100644 --- a/src/Composer/Installer.php +++ b/src/Composer/Installer.php @@ -295,7 +295,16 @@ class Installer $installFromLock = false; if (!$this->update && $this->locker->isLocked()) { $installFromLock = true; - $lockedRepository = $this->locker->getLockedRepository($withDevReqs); + try { + $lockedRepository = $this->locker->getLockedRepository($withDevReqs); + } catch (\RuntimeException $e) { + // if there are dev requires, then we really can not install + if ($this->package->getDevRequires()) { + throw $e; + } + // no require-dev in composer.json and the lock file was created with no dev info, so skip them + $lockedRepository = $this->locker->getLockedRepository(); + } } $this->whitelistUpdateDependencies(