WordPress.org

Make WordPress Core

Changeset 6151


Ignore:
Timestamp:
09/22/07 00:08:50 (7 years ago)
Author:
markjaquith
Message:

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

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/update.php

    r6026 r6151  
    4343function wp_update_plugins() { 
    4444    global $wp_version; 
     45 
     46    if ( !function_exists('fsockopen') ) 
     47        return false; 
     48 
    4549    $plugins = get_plugins(); 
    4650    $active  = get_option( 'active_plugins' ); 
     
    8488 
    8589    $response = ''; 
    86     if( false != ( $fs = @fsockopen( 'api.wordpress.org', 80, $errno, $errstr, 3) ) ) { 
     90    if( false != ( $fs = @fsockopen( 'api.wordpress.org', 80, $errno, $errstr, 3) ) && is_resource($fs) ) { 
    8791        fwrite($fs, $http_request); 
    8892 
  • trunk/wp-includes/update.php

    r6026 r6151  
    44 
    55function wp_version_check() { 
    6     if ( strpos($_SERVER['PHP_SELF'], 'install.php') !== false || defined('WP_INSTALLING') ) 
     6    if ( !function_exists('fsockopen') || strpos($_SERVER['PHP_SELF'], 'install.php') !== false || defined('WP_INSTALLING') ) 
    77        return; 
    88 
     
    3131 
    3232    $response = ''; 
    33     if ( false !== ( $fs = @fsockopen( 'api.wordpress.org', 80, $errno, $errstr, 3 ) ) ) { 
     33    if ( false !== ( $fs = @fsockopen( 'api.wordpress.org', 80, $errno, $errstr, 3 ) ) && is_resource($fs) ) { 
    3434        fwrite( $fs, $http_request ); 
    3535        while ( !feof( $fs ) ) 
Note: See TracChangeset for help on using the changeset viewer.