From fe261114bddce3166963bef84f540a8d08325130 Mon Sep 17 00:00:00 2001 From: Andrew Nacin Date: Tue, 1 Apr 2014 02:58:10 +0000 Subject: [PATCH] Background Updates: Fix a PHP fatal error which could be encountered on some systems when using FTP. Merges [26148] from 3.8 to the 3.7 branch. props dd32. fixes #25817. Built from https://develop.svn.wordpress.org/branches/3.7@27881 git-svn-id: http://core.svn.wordpress.org/branches/3.7@27712 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/includes/class-wp-upgrader.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/wp-admin/includes/class-wp-upgrader.php b/wp-admin/includes/class-wp-upgrader.php index 90b9658d57..3b265f30c2 100644 --- a/wp-admin/includes/class-wp-upgrader.php +++ b/wp-admin/includes/class-wp-upgrader.php @@ -1333,8 +1333,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()); @@ -1897,6 +1898,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 ) ) {