From bf6d1bc253ed9e810da81b7605882d7714b4b20f Mon Sep 17 00:00:00 2001 From: terrafrost Date: Wed, 28 Aug 2013 13:55:14 -0500 Subject: [PATCH] SFTP_Stream: fix errors when context isn't defined --- phpseclib/Net/SFTP/Stream.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/phpseclib/Net/SFTP/Stream.php b/phpseclib/Net/SFTP/Stream.php index 1527b0dc..30cbc86b 100644 --- a/phpseclib/Net/SFTP/Stream.php +++ b/phpseclib/Net/SFTP/Stream.php @@ -159,9 +159,11 @@ class Net_SFTP_Stream { return false; } - $context = stream_context_get_params($this->context); - if (isset($context['notification'])) { - $this->notification = $context['notification']; + if (isset($this->context)) { + $context = stream_context_get_params($this->context); + if (isset($context['notification'])) { + $this->notification = $context['notification']; + } } if ($host[0] == '$') { @@ -172,7 +174,9 @@ class Net_SFTP_Stream { } $this->sftp = $$host; } else { - $context = stream_context_get_options($this->context); + if (isset($this->contenxt)) { + $context = stream_context_get_options($this->context); + } if (isset($context['sftp']['session'])) { $sftp = $context['sftp']['session']; }