Core and plugin update checking: make sure fsockopen() is available and check file resources with is_resource() -- both to prevent feof() infinite loops. Props xknown. fixes #5037
git-svn-id: http://svn.automattic.com/wordpress/trunk@6151 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
@@ -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) )
|
||||
|
||||
Reference in New Issue
Block a user