diff --git a/phpseclib/Net/SFTP.php b/phpseclib/Net/SFTP.php index fe937706..707808bb 100644 --- a/phpseclib/Net/SFTP.php +++ b/phpseclib/Net/SFTP.php @@ -1415,6 +1415,7 @@ class SFTP extends 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: diff --git a/tests/Functional/Net/SFTPUserStoryTest.php b/tests/Functional/Net/SFTPUserStoryTest.php index fcc41eda..963ead41 100644 --- a/tests/Functional/Net/SFTPUserStoryTest.php +++ b/tests/Functional/Net/SFTPUserStoryTest.php @@ -240,6 +240,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) {