From 0525297ff5c9777823ef24375eaf41073d196b82 Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Wed, 20 Feb 2013 13:27:45 +0100 Subject: [PATCH] Always move time to the end of the package spec in the lock file, fixes #1498 --- src/Composer/Package/Locker.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/Composer/Package/Locker.php b/src/Composer/Package/Locker.php index 48eddfca2..e867860fc 100644 --- a/src/Composer/Package/Locker.php +++ b/src/Composer/Package/Locker.php @@ -287,11 +287,15 @@ class Locker $spec = $this->dumper->dump($package); unset($spec['version_normalized']); + // always move time to the end of the package definition + $time = isset($spec['time']) ? $spec['time'] : null; + unset($spec['time']); if ($package->isDev()) { - $time = $this->getPackageTime($package); - if (null !== $time) { - $spec['time'] = $time; - } + // use the exact commit time of the current reference if it's a dev package + $time = $this->getPackageTime($package) ?: $time; + } + if (null !== $time) { + $spec['time'] = $time; } unset($spec['installation-source']);