Explorar o código

Merge pull request #1598 from fabpot/package-time-fix

fixed time parsing when the composer.lock file has an old time format
Jordi Boggiano %!s(int64=12) %!d(string=hai) anos
pai
achega
b7cd971b06
Modificáronse 1 ficheiros con 3 adicións e 1 borrados
  1. 3 1
      src/Composer/Package/Loader/ArrayLoader.php

+ 3 - 1
src/Composer/Package/Loader/ArrayLoader.php

@@ -135,8 +135,10 @@ class ArrayLoader implements LoaderInterface
         }
 
         if (!empty($config['time'])) {
+            $time = ctype_digit($config['time']) ? '@'.$config['time'] : $config['time'];
+
             try {
-                $date = new \DateTime($config['time'], new \DateTimeZone('UTC'));
+                $date = new \DateTime($time, new \DateTimeZone('UTC'));
                 $package->setReleaseDate($date);
             } catch (\Exception $e) {
             }