From a23ead14678c17904e65cbda7b3acf9887abfce6 Mon Sep 17 00:00:00 2001 From: Dion Hulse Date: Thu, 14 Nov 2013 02:01:30 +0000 Subject: [PATCH] Background Updates: Fix a PHP Fatal error which could be encountered on some systems when using FTP. Fixes #25817 for trunk. git-svn-id: https://develop.svn.wordpress.org/trunk@26148 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-admin/includes/class-wp-upgrader.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/wp-admin/includes/class-wp-upgrader.php b/src/wp-admin/includes/class-wp-upgrader.php index 1d6777adc8..5d8b267964 100644 --- a/src/wp-admin/includes/class-wp-upgrader.php +++ b/src/wp-admin/includes/class-wp-upgrader.php @@ -1334,8 +1334,9 @@ class Core_Upgrader extends WP_Upgrader { return new WP_Error('up_to_date', $this->strings['up_to_date']); $res = $this->fs_connect( array(ABSPATH, WP_CONTENT_DIR) ); - if ( is_wp_error($res) ) + if ( ! $res || is_wp_error( $res ) ) { return $res; + } $wp_dir = trailingslashit($wp_filesystem->abspath()); @@ -1899,6 +1900,11 @@ class WP_Automatic_Updater { 'attempt_rollback' => true, /* only available for core updates */ ) ); + // if the filesystem is unavailable, false is returned. + if ( false === $upgrade_result ) { + $upgrade_result = new WP_Error( 'fs_unavailable', __( 'Could not access filesystem.' ) ); + } + // Core doesn't output this, so lets append it so we don't get confused if ( 'core' == $type ) { if ( is_wp_error( $upgrade_result ) ) {