Skip to content

Commit c650864

Browse files
Filesystem API: Define password as null if not set when using SSH2 with public/private keys.
This resolves an `Undefined array key "password"` PHP warning in `WP_Filesystem_SSH2::connect()` when using public/private key authentication, in which case providing a password is optional. Follow-up to [8865]. Props J-Dill, costdev, ehsanakhgari, dd32. Fixes #33196. git-svn-id: https://develop.svn.wordpress.org/trunk@56111 602fd350-edb4-49c9-b593-d223f7449a82
1 parent e0aaa2a commit c650864

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/wp-admin/includes/class-wp-filesystem-ssh2.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,8 @@ public function __construct( $opt = '' ) {
103103
// Password can be blank if we are using keys.
104104
if ( ! $this->keys ) {
105105
$this->errors->add( 'empty_password', __( 'SSH2 password is required' ) );
106+
} else {
107+
$this->options['password'] = null;
106108
}
107109
} else {
108110
$this->options['password'] = $opt['password'];

0 commit comments

Comments
 (0)