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.
Built from https://develop.svn.wordpress.org/trunk@56111


git-svn-id: http://core.svn.wordpress.org/trunk@55623 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2023-06-29 17:05:30 +00:00
parent 03f194d679
commit 86d28672fe
2 changed files with 3 additions and 1 deletions

View File

@ -103,6 +103,8 @@ class WP_Filesystem_SSH2 extends WP_Filesystem_Base {
// Password can be blank if we are using keys.
if ( ! $this->keys ) {
$this->errors->add( 'empty_password', __( 'SSH2 password is required' ) );
} else {
$this->options['password'] = null;
}
} else {
$this->options['password'] = $opt['password'];

View File

@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
$wp_version = '6.3-beta2-56110';
$wp_version = '6.3-beta2-56111';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.