--- class-wp-filesystem-ssh2.php.orig	2016-07-06 21:29:56.050359228 -0400
+++ class-wp-filesystem-ssh2.php	2016-09-03 21:18:50.630535553 -0400
@@ -162,7 +162,6 @@
 			);
 			return false;
 		}
-
 		return true;
 	}
 
@@ -183,14 +182,33 @@
 	 */
 	public function sftp_path( $path ) {
 		if ( '/' === $path ) {
-			$path = '/./';
+			$path = '.';
 		}
 		return 'ssh2.sftp://' . $this->sftp_link . '/' . ltrim( $path, '/' );
 	}
 
 	/**
+	 * Gets the ssh2.sftp file status
+	 *
 	 * @access public
-	 * 
+	 *
+	 * The stream wrapper is no reliably returning status data.  ssh2_sftp_stat
+	 * reliably returns a status structure.  This contains most of the status
+	 * data we are checking.  It may be worthwhile to cache the stats for a
+	 * path as it is common to ask for multiple stats for the same path.
+	 *
+	 * @since 4.6.0
+	 *
+	 * @param string $path The File/Directory path on the remote server to stat
+	 * @return stat structure for the file or directory
+	 */
+	public function sftp_stat( $path ) {
+		return ssh2_sftp_stat( $this->sftp_link, $path );
+	}
+
+	/**
+	 * @access public
+	 *
 	 * @param string $command
 	 * @param bool $returnbool
 	 * @return bool|string
@@ -350,7 +368,7 @@
 	 * @return string|false
 	 */
 	public function owner($file) {
-		$owneruid = @fileowner( $this->sftp_path( $file ) );
+		$owneruid = $this->sftp_stat( $file )['uid'];
 		if ( ! $owneruid )
 			return false;
 		if ( ! function_exists('posix_getpwuid') )
@@ -366,7 +384,7 @@
 	 * @return string
 	 */
 	public function getchmod($file) {
-		return substr( decoct( @fileperms( $this->sftp_path( $file ) ) ), -3 );
+		return substr( decoct( $this->sftp_stat( $file )['mode'] ), -3 );
 	}
 
 	/**
@@ -376,7 +394,7 @@
 	 * @return string|false
 	 */
 	public function group($file) {
-		$gid = @filegroup( $this->sftp_path( $file ) );
+		$gid = $this->sftp_stat( $file )['gid'];
 		if ( ! $gid )
 			return false;
 		if ( ! function_exists('posix_getgrgid') )
@@ -444,7 +462,7 @@
 	 * @return bool
 	 */
 	public function exists($file) {
-		return file_exists( $this->sftp_path( $file ) );
+		return = $this->sftp_stat( $file );
 	}
 
 	/**
@@ -454,7 +472,7 @@
 	 * @return bool
 	 */
 	public function is_file($file) {
-		return is_file( $this->sftp_path( $file ) );
+		return substr( decoct( $this->sftp_stat( $file )['mode'] ), 0, 1 ) == 1;
 	}
 
 	/**
@@ -464,7 +482,7 @@
 	 * @return bool
 	 */
 	public function is_dir($path) {
-		return is_dir( $this->sftp_path( $path ) );
+		return substr( decoct( $this->sftp_stat( $path )['mode'] ), 0, 1 ) == 4;
 	}
 
 	/**
@@ -495,7 +513,7 @@
 	 * @return int
 	 */
 	public function atime($file) {
-		return fileatime( $this->sftp_path( $file ) );
+		return $this->sftp_stat( $file )['atime'];
 	}
 
 	/**
@@ -505,7 +523,7 @@
 	 * @return int
 	 */
 	public function mtime($file) {
-		return filemtime( $this->sftp_path( $file ) );
+		return $this->sftp_stat( $file )['mtime'];
 	}
 
 	/**
@@ -515,7 +533,7 @@
 	 * @return int
 	 */
 	public function size($file) {
-		return filesize( $this->sftp_path( $file ) );
+		return $this->sftp_stat( $file )['size'];
 	}
 
 	/**
