From 10d96716015ed51eb40e3bf76f62c70167115c96 Mon Sep 17 00:00:00 2001 From: terrafrost Date: Tue, 8 Jan 2013 11:15:28 -0600 Subject: [PATCH] SSH1: Fix E_NOTICE (thanks nosx!) --- phpseclib/Net/SSH1.php | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/phpseclib/Net/SSH1.php b/phpseclib/Net/SSH1.php index 50add201..2932cf71 100644 --- a/phpseclib/Net/SSH1.php +++ b/phpseclib/Net/SSH1.php @@ -1018,19 +1018,11 @@ class Net_SSH1 { return false; } - if (defined('NET_SSH1_LOGGING')) { - $temp = isset($this->protocol_flags[ord($data[0])]) ? $this->protocol_flags[ord($data[0])] : 'UNKNOWN'; - $this->protocol_flags_log[] = '-> ' . $temp . - ' (' . round($stop - $start, 4) . 's)'; - if (NET_SSH1_LOGGING == NET_SSH1_LOG_COMPLEX) { - $this->message_log[] = substr($data, 1); - } - } - $length = strlen($data) + 4; $padding = crypt_random_string(8 - ($length & 7)); + $orig = $data; $data = $padding . $data; $data.= pack('N', $this->_crc($data)); @@ -1043,6 +1035,15 @@ class Net_SSH1 { $start = strtok(microtime(), ' ') + strtok(''); // http://php.net/microtime#61838 $result = strlen($packet) == fputs($this->fsock, $packet); $stop = strtok(microtime(), ' ') + strtok(''); + + if (defined('NET_SSH1_LOGGING')) { + $temp = isset($this->protocol_flags[ord($orig[0])]) ? $this->protocol_flags[ord($orig[0])] : 'UNKNOWN'; + $this->protocol_flags_log[] = '-> ' . $temp . + ' (' . round($stop - $start, 4) . 's)'; + if (NET_SSH1_LOGGING == NET_SSH1_LOG_COMPLEX) { + $this->message_log[] = substr($orig, 1); + } + } return $result; }