From 77d5f8da204a47ff11faefc4b86c88b5209e1bf8 Mon Sep 17 00:00:00 2001 From: splitice Date: Fri, 20 Nov 2015 07:11:43 +1100 Subject: [PATCH] Fix PHP invalid index warning --- phpseclib/Net/SSH2.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/phpseclib/Net/SSH2.php b/phpseclib/Net/SSH2.php index 1e815e0e..7cde0875 100644 --- a/phpseclib/Net/SSH2.php +++ b/phpseclib/Net/SSH2.php @@ -3880,7 +3880,11 @@ class Net_SSH2 */ function getLastError() { - return $this->errors[count($this->errors) - 1]; + $count = count($this->errors); + + if ($count > 0) { + return $this->errors[$count - 1]; + } } /**