From 11880f016f462e2d46ce37e6b3089c5f61002a09 Mon Sep 17 00:00:00 2001 From: Daniel Bojdo Date: Mon, 3 Dec 2012 14:51:45 +0100 Subject: [PATCH] Update src/Composer/Package/Locker.php There were some cases when result of execute was 0 but output was empty string. It causes an exception in line 295 (create DateTime object from "@" string). --- src/Composer/Package/Locker.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Composer/Package/Locker.php b/src/Composer/Package/Locker.php index a474f654e..04d17d164 100644 --- a/src/Composer/Package/Locker.php +++ b/src/Composer/Package/Locker.php @@ -291,7 +291,7 @@ class Locker if (function_exists('proc_open') && 'git' === $package->getSourceType() && ($path = $this->installationManager->getInstallPath($package))) { $sourceRef = $package->getSourceReference() ?: $package->getDistReference(); $process = new ProcessExecutor(); - if (0 === $process->execute('git log -n1 --pretty=%ct '.escapeshellarg($sourceRef), $output, $path)) { + if (0 === $process->execute('git log -n1 --pretty=%ct '.escapeshellarg($sourceRef), $output, $path) && !empty($output)) { $datetime = new \DateTime('@'.$output, new \DateTimeZone('UTC')); $spec['time'] = $datetime->format('Y-m-d H:i:s'); }