From d71da6b02bbbe8ce64dfaff2686c452c9093dbe5 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Thu, 25 Jun 2015 14:26:35 +0200 Subject: [PATCH] Explicitly set size to 0 when creating or truncating. --- phpseclib/Net/SFTP/Stream.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/phpseclib/Net/SFTP/Stream.php b/phpseclib/Net/SFTP/Stream.php index 3d583fa9..0085b959 100644 --- a/phpseclib/Net/SFTP/Stream.php +++ b/phpseclib/Net/SFTP/Stream.php @@ -282,6 +282,7 @@ class Net_SFTP_Stream return false; } else { $this->sftp->touch($path); + $this->size = 0; } } else { switch ($this->mode[0]) { @@ -289,6 +290,7 @@ class Net_SFTP_Stream return false; case 'w': $this->sftp->truncate($path, 0); + $this->size = 0; } }