1
0
Fork 0

Make sure only proper timestamps are used for the lock, refs #1390

pull/1392/head
Jordi Boggiano 2012-12-05 21:44:20 +01:00
parent 6ed65c9e91
commit 8af6581bdf
1 changed files with 2 additions and 2 deletions

View File

@ -291,8 +291,8 @@ 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) && !empty($output)) {
$datetime = new \DateTime('@'.$output, new \DateTimeZone('UTC'));
if (0 === $process->execute('git log -n1 --pretty=%ct '.escapeshellarg($sourceRef), $output, $path) && preg_match('{^\s*\d+\s*$}', $output)) {
$datetime = new \DateTime('@'.trim($output), new \DateTimeZone('UTC'));
$spec['time'] = $datetime->format('Y-m-d H:i:s');
}
}