Skip to content

Commit

Permalink
lib/Horde/Vfs/Ssh2.php: ssh2_sftp_statinfo() returns boolean false on…
Browse files Browse the repository at this point in the history
… non-existent files/folders. Avoid accessing those return results as arrays.
  • Loading branch information
sunweaver authored and mrubinsk committed Oct 3, 2020
1 parent 5a232f0 commit ed9f9f0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/Horde/Vfs/Ssh2.php
Expand Up @@ -101,7 +101,7 @@ public function size($path, $name)
$this->_connect();

$statinfo = @ssh2_sftp_stat($this->_sftp, $this->_getPath($path, $name));
if (($size = $statinfo['size']) === false) {
if ( ($statinfo === false) or (($size = $statinfo['size']) === false) ) {
throw new Horde_Vfs_Exception(sprintf('Unable to check file size of "%s".', $this->_getPath($path, $name)));
}

Expand Down Expand Up @@ -260,7 +260,7 @@ public function isFolder($path, $name)
/* See if we can stat the remote filename. ANDed with 040000 is true
* if it is a directory. */
$statinfo = @ssh2_sftp_stat($this->_sftp, $this->_getPath($path, $name));
return $statinfo['mode'] & 040000;
return ( $statinfo !== false ) and ( $statinfo['mode'] & 040000 );
}

/**
Expand Down

0 comments on commit ed9f9f0

Please sign in to comment.