Merge pull request #852 from bantu/sftp-chmod-realpath

Fix SFTP::chmod not using realpath on the filepath

* bantu/sftp-chmod-realpath:
  Add test case for GitHub Issue 850: Realpath in SFTP chmod().
  Fixed a bug in SFTP::chmod not using realpath on the filepath
This commit is contained in:
Andreas Fischer 2015-10-19 00:19:07 +02:00
commit dd34eb1c30
2 changed files with 15 additions and 0 deletions

View File

@ -1454,6 +1454,7 @@ class Net_SFTP extends Net_SSH2
return true;
}
$filename = $this->_realPath($filename);
// rather than return what the permissions *should* be, we'll return what they actually are. this will also
// tell us if the file actually exists.
// incidentally, SFTPv4+ adds an additional 32-bit integer field - flags - to the following:

View File

@ -238,6 +238,20 @@ class Functional_Net_SFTPUserStoryTest extends PhpseclibFunctionalTestCase
/**
* @depends testTruncate
* @group github850
*/
public function testChModOnFile($sftp)
{
$this->assertNotFalse(
$sftp->chmod(0755, 'file1.txt'),
'Failed asserting that chmod() was successful.'
);
return $sftp;
}
/**
* @depends testChModOnFile
*/
public function testChDirOnFile($sftp)
{