mirror of
https://github.com/phpseclib/phpseclib.git
synced 2025-01-27 00:58:25 +00:00
Merge branch 'sftp-endless-loop' into sftp-endless-loop-v2
Conflicts: phpseclib/Net/SFTP.php
This commit is contained in:
commit
26ddf02fee
@ -1876,10 +1876,12 @@ class SFTP extends SSH2
|
|||||||
|
|
||||||
if ($local_start >= 0) {
|
if ($local_start >= 0) {
|
||||||
fseek($fp, $local_start);
|
fseek($fp, $local_start);
|
||||||
|
$size-= $local_start;
|
||||||
} elseif ($mode & self::RESUME_START) {
|
} elseif ($mode & self::RESUME_START) {
|
||||||
// do nothing
|
// do nothing
|
||||||
} else {
|
} else {
|
||||||
fseek($fp, $offset);
|
fseek($fp, $offset);
|
||||||
|
$size-= $offset;
|
||||||
}
|
}
|
||||||
} elseif ($dataCallback) {
|
} elseif ($dataCallback) {
|
||||||
$size = 0;
|
$size = 0;
|
||||||
|
@ -651,5 +651,22 @@ class Functional_Net_SFTPUserStoryTest extends PhpseclibFunctionalTestCase
|
|||||||
$this->assertSame($stat['type'], NET_SFTP_TYPE_SYMLINK);
|
$this->assertSame($stat['type'], NET_SFTP_TYPE_SYMLINK);
|
||||||
|
|
||||||
$sftp->enableStatCache();
|
$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.'
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user