Merge branch '1.0' into 2.0

This commit is contained in:
terrafrost 2022-01-08 19:50:36 -06:00
commit 676b099789
2 changed files with 18 additions and 1 deletions

View File

@ -1724,7 +1724,7 @@ class SFTP extends SSH2
function chgrp($filename, $gid, $recursive = false)
{
$attr = $this->version < 4 ?
pack('N3', NET_SFTP_ATTR_UIDGID, $gid, -1) :
pack('N3', NET_SFTP_ATTR_UIDGID, -1, $gid) :
pack('NNa*Na*', NET_SFTP_ATTR_OWNERGROUP, 0, '', strlen($gid), $gid);
return $this->_setstat($filename, $attr, $recursive);

View File

@ -756,5 +756,22 @@ class Functional_Net_SFTPUserStoryTest extends PhpseclibFunctionalTestCase
$list_cache_disabled = $sftp->rawlist('.', true);
$this->assertEquals($list_cache_enabled, $list_cache_disabled, 'The files should be the same regardless of stat cache', 0.0, 10, true);
return $sftp;
}
/**
* @depends testRawlistDisabledStatCache
*/
public function testChownChgrp($sftp)
{
$stat = $sftp->stat(self::$scratchDir);
$this->assertTrue($sftp->chown(self::$scratchDir, $stat['uid']));
$this->assertTrue($sftp->chgrp(self::$scratchDir, $stat['gid']));
$sftp->clearStatCache();
$stat2 = $sftp->stat(self::$scratchDir);
$this->assertSame($stat['uid'], $stat2['uid']);
$this->assertSame($stat['gid'], $stat2['gid']);
}
}