Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update PR 1751 + add tests, improve coverage. #3044

Closed
7 changes: 6 additions & 1 deletion src/wp-admin/includes/class-wp-upgrader.php
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,8 @@ public function generic_strings() {
/* translators: %s: Directory name. */
$this->strings['fs_no_folder'] = __( 'Unable to locate needed folder (%s).' );

$this->strings['no_package'] = __( 'Package not available.' );

$this->strings['download_failed'] = __( 'Download failed.' );
$this->strings['installing_package'] = __( 'Installing the latest version…' );
$this->strings['no_files'] = __( 'The package contains no files.' );
Expand Down Expand Up @@ -527,7 +529,10 @@ public function install_package( $args = array() ) {
set_time_limit( 300 );
}

if ( empty( $source ) || empty( $destination ) ) {
if (
( ! is_string( $source ) || '' === trim( $source ) ) ||
( ! is_string( $destination ) || '' === trim( $destination ) )
) {
return new WP_Error( 'bad_request', $this->strings['bad_request'] );
}
$this->skin->feedback( 'installing_package' );
Expand Down
Loading