Merge branch 'sftp-endless-loop' into sftp-endless-loop-v2

Conflicts:
	phpseclib/Net/SFTP.php
This commit is contained in:
terrafrost 2015-09-28 09:20:38 -05:00
commit 26ddf02fee
2 changed files with 19 additions and 0 deletions

View File

@ -1876,10 +1876,12 @@ class SFTP extends SSH2
if ($local_start >= 0) {
fseek($fp, $local_start);
$size-= $local_start;
} elseif ($mode & self::RESUME_START) {
// do nothing
} else {
fseek($fp, $offset);
$size-= $offset;
}
} elseif ($dataCallback) {
$size = 0;

View File

@ -651,5 +651,22 @@ class Functional_Net_SFTPUserStoryTest extends PhpseclibFunctionalTestCase
$this->assertSame($stat['type'], NET_SFTP_TYPE_SYMLINK);
$sftp->enableStatCache();
return $sftp;
}
/**
* @depends testStatVsLstat
* @group github830
*/
public function testEndlessLoopOnUpload($sftp)
{
$sftp->put('endless.txt', 'res.txt', SFTP::SOURCE_LOCAL_FILE, 0, 10);
$this->assertSame(
substr(self::$exampleData, 10),
$sftp->get('endless.txt'),
'Failed asserting that portions of a file could be uploaded.'
);
}
}