diff --git a/phpseclib/Net/SFTP.php b/phpseclib/Net/SFTP.php index fb136bd7..cdf0bec6 100644 --- a/phpseclib/Net/SFTP.php +++ b/phpseclib/Net/SFTP.php @@ -2489,14 +2489,6 @@ class SFTP extends SSH2 } } - if ($length > 0 && $length <= $offset - $start) { - if ($local_file === false) { - $content = substr($content, 0, $length); - } else { - ftruncate($fp, $length + $res_offset); - } - } - if ($fclose_check) { fclose($fp); diff --git a/tests/Functional/Net/SFTPUserStoryTest.php b/tests/Functional/Net/SFTPUserStoryTest.php index b5036378..58d33d46 100644 --- a/tests/Functional/Net/SFTPUserStoryTest.php +++ b/tests/Functional/Net/SFTPUserStoryTest.php @@ -796,5 +796,18 @@ class SFTPUserStoryTest extends PhpseclibFunctionalTestCase $stat2 = $sftp->stat(self::$scratchDir); $this->assertSame($stat['uid'], $stat2['uid']); $this->assertSame($stat['gid'], $stat2['gid']); + + return $sftp; + } + + /** + * @depends testChownChgrp + * @group github1934 + */ + public function testCallableGetWithLength($sftp) + { + $sftp->put('test.txt', 'zzzzz'); + $sftp->get('test.txt', function($data) {}, 0, 1); + $this->assertTrue(true); } }