1
0
Fork 0

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).
pull/1384/head
Daniel Bojdo 2012-12-03 14:51:45 +01:00
parent ace3eefe1a
commit 11880f016f
1 changed files with 1 additions and 1 deletions

View File

@ -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');
}