diff --git a/phpseclib/Net/SCP.php b/phpseclib/Net/SCP.php index 64756c49..8587de77 100644 --- a/phpseclib/Net/SCP.php +++ b/phpseclib/Net/SCP.php @@ -201,7 +201,7 @@ class Net_SCP { return false; } $size = filesize($data); - for ($i = 0; $i < $length; $i++) { + for ($i = 0; $i < $size; $i += $this->packet_size) { $this->_send(fgets($fp, $this->packet_size)); } fclose($fp); @@ -338,4 +338,4 @@ class Net_SCP { $this->ssh->disconnect(); } } -} \ No newline at end of file +} diff --git a/phpseclib/Net/SFTP/Stream.php b/phpseclib/Net/SFTP/Stream.php index 551ee38a..43febd4e 100644 --- a/phpseclib/Net/SFTP/Stream.php +++ b/phpseclib/Net/SFTP/Stream.php @@ -262,7 +262,7 @@ class Net_SFTP_Stream { } } - $this->pos = $this->mode[0] != 'a' ? 0 : $size; + $this->pos = $this->mode[0] != 'a' ? 0 : $this->size; return true; } @@ -297,7 +297,7 @@ class Net_SFTP_Stream { return 0; } // seems that PHP calls stream_read in 8k chunks - call_user_func($this->notification, STREAM_NOTIFY_PROGRESS, STREAM_NOTIFY_SEVERITY_INFO, '', 0, strlen($result), $size); + call_user_func($this->notification, STREAM_NOTIFY_PROGRESS, STREAM_NOTIFY_SEVERITY_INFO, '', 0, strlen($result), $this->size); } if (empty($result)) { // ie. false or empty string @@ -756,4 +756,4 @@ class Net_SFTP_Stream { } } -stream_wrapper_register('sftp', 'Net_SFTP_Stream'); \ No newline at end of file +stream_wrapper_register('sftp', 'Net_SFTP_Stream');