From f99f06206ed62bbd61688de027d0195d14ab1b61 Mon Sep 17 00:00:00 2001 From: Dion Hulse Date: Thu, 1 Oct 2015 05:42:20 +0000 Subject: [PATCH] Updates: SSH2 Transport: Add a connection error when the SFTP subsystem cannot be initialized. Fixes #33478 git-svn-id: https://develop.svn.wordpress.org/trunk@34739 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-admin/includes/class-wp-filesystem-ssh2.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/wp-admin/includes/class-wp-filesystem-ssh2.php b/src/wp-admin/includes/class-wp-filesystem-ssh2.php index bc978d5141..1b3a3b5964 100644 --- a/src/wp-admin/includes/class-wp-filesystem-ssh2.php +++ b/src/wp-admin/includes/class-wp-filesystem-ssh2.php @@ -130,7 +130,11 @@ class WP_Filesystem_SSH2 extends WP_Filesystem_Base { } } - $this->sftp_link = ssh2_sftp($this->link); + $this->sftp_link = ssh2_sftp( $this->link ); + if ( ! $this->sftp_link ) { + $this->errors->add( 'connect', sprintf( __( 'Failed to initialize a SFTP subsystem session with the SSH2 Server %1$s:%2$s' ), $this->options['hostname'], $this->options['port'] ) ); + return false; + } return true; }