From: Chuck Hagenbuch Date: Wed, 17 Jun 2009 16:00:55 +0000 (-0400) Subject: tweaks I needed for logs and patchset lists to still work and not throw warnings... X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=50bda8de10421e02d66d836e8c832938e38b2b68;p=horde.git tweaks I needed for logs and patchset lists to still work and not throw warnings/errors --- diff --git a/framework/Vcs/lib/Horde/Vcs.php b/framework/Vcs/lib/Horde/Vcs.php index ab50b384f..7a1feec5e 100644 --- a/framework/Vcs/lib/Horde/Vcs.php +++ b/framework/Vcs/lib/Horde/Vcs.php @@ -1061,7 +1061,7 @@ abstract class Horde_Vcs_Log { protected $_rep; protected $_file; - protected $_files; + protected $_files = array(); protected $_rev; protected $_author; protected $_tags = array(); @@ -1173,7 +1173,7 @@ abstract class Horde_Vcs_Log { return is_null($file) ? $this->_files - : (isset($this->_files[$file]) ? $this->_files[$file] : null); + : (isset($this->_files[$file]) ? $this->_files[$file] : array()); } } diff --git a/framework/Vcs/lib/Horde/Vcs/Git.php b/framework/Vcs/lib/Horde/Vcs/Git.php index ca3de1f68..7722607ae 100644 --- a/framework/Vcs/lib/Horde/Vcs/Git.php +++ b/framework/Vcs/lib/Horde/Vcs/Git.php @@ -653,16 +653,10 @@ class Horde_Vcs_Log_Git extends Horde_Vcs_Log throw new Horde_Vcs_Exception('Unable to run ' . $cmd . ': ' . error_get_last()); } - $line = trim(fgets($pipe)); + //$line = trim(fgets($pipe)); while (true) { - $line = fgets($pipe); - if ($line === false) { - throw new Horde_Vcs_Exception('Unexpected end of log output'); - } - - $line = trim($line); - if ($line == '') { break; } - + $line = trim(fgets($pipe)); + if (!strlen($line)) { break; } if (strpos($line, ':') === false) { throw new Horde_Vcs_Exception('Malformed log line: ' . $line); } @@ -710,7 +704,7 @@ class Horde_Vcs_Log_Git extends Horde_Vcs_Log $log = ''; $line = fgets($pipe); - while (substr($line, 0, 1) != ':') { + while ($line !== false && substr($line, 0, 1) != ':') { $log .= $line; $line = fgets($pipe); }