diff --git a/wp-admin/includes/update.php b/wp-admin/includes/update.php index 1fc33b9a68..41945d2b3d 100644 --- a/wp-admin/includes/update.php +++ b/wp-admin/includes/update.php @@ -42,6 +42,10 @@ add_action( 'admin_notices', 'update_nag', 3 ); function wp_update_plugins() { global $wp_version; + + if ( !function_exists('fsockopen') ) + return false; + $plugins = get_plugins(); $active = get_option( 'active_plugins' ); $current = get_option( 'update_plugins' ); @@ -83,7 +87,7 @@ function wp_update_plugins() { $http_request .= $request; $response = ''; - if( false != ( $fs = @fsockopen( 'api.wordpress.org', 80, $errno, $errstr, 3) ) ) { + if( false != ( $fs = @fsockopen( 'api.wordpress.org', 80, $errno, $errstr, 3) ) && is_resource($fs) ) { fwrite($fs, $http_request); while ( !feof($fs) ) diff --git a/wp-includes/update.php b/wp-includes/update.php index 48e1fec1ca..53f79590e0 100644 --- a/wp-includes/update.php +++ b/wp-includes/update.php @@ -3,7 +3,7 @@ // A simple set of functions to check our version 1.0 update service function wp_version_check() { - if ( strpos($_SERVER['PHP_SELF'], 'install.php') !== false || defined('WP_INSTALLING') ) + if ( !function_exists('fsockopen') || strpos($_SERVER['PHP_SELF'], 'install.php') !== false || defined('WP_INSTALLING') ) return; global $wp_version; @@ -30,7 +30,7 @@ function wp_version_check() { $http_request .= "\r\n"; $response = ''; - if ( false !== ( $fs = @fsockopen( 'api.wordpress.org', 80, $errno, $errstr, 3 ) ) ) { + if ( false !== ( $fs = @fsockopen( 'api.wordpress.org', 80, $errno, $errstr, 3 ) ) && is_resource($fs) ) { fwrite( $fs, $http_request ); while ( !feof( $fs ) ) $response .= fgets( $fs, 1160 ); // One TCP-IP packet