Merge branch '2.0'

* 2.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 1119e4ad91
2 changed files with 22 additions and 2 deletions

View File

@ -1175,7 +1175,7 @@ class SFTP extends 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

@ -429,8 +429,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)