1
0
mirror of https://github.com/danog/tgseclib.git synced 2024-11-27 04:34:45 +01:00

Merge pull request #719 from terrafrost/lstat-fix-1.0

SFTP: update conditions under which cache for lstat / . is used for 1.0 branch

* terrafrost/lstat-fix-1.0:
  Tests/SFTP: $lstat->$stat
  Tests/SFTP: just check to see that stat / lstat return an array
  SFTP: update conditions under which cache for lstat / . is used
  Tests/SFTP: add test for stat's on .
This commit is contained in:
Andreas Fischer 2015-06-27 21:59:45 +02:00
commit 1ad66ad1ea
2 changed files with 22 additions and 2 deletions

View File

@ -1214,7 +1214,7 @@ class Net_SFTP extends Net_SSH2
if ($this->use_stat_cache) {
$result = $this->_query_stat_cache($filename);
if (is_array($result) && isset($result['.'])) {
if (is_array($result) && isset($result['.']) && isset($result['.']->lstat)) {
return $result['.']->lstat;
}
if (is_object($result) && isset($result->lstat)) {

View File

@ -427,8 +427,28 @@ class Functional_Net_SFTPUserStoryTest extends PhpseclibFunctionalTestCase
}
/**
* on older versions this would result in a fatal error
* @depends testReadlink
* @group github716
*/
public function testStatOnCWD($sftp)
{
$stat = $sftp->stat('.');
$this->assertInternalType(
'array', $stat,
'Failed asserting that stat on . returns an array'
);
$lstat = $sftp->lstat('.');
$this->assertInternalType(
'array', $lstat,
'Failed asserting that lstat on . returns an array'
);
return $sftp;
}
/**
* on older versions this would result in a fatal error
* @depends testStatOnCWD
* @group github402
*/
public function testStatcacheFix($sftp)