WordPress.org

Make WordPress Core

Changeset 20311


Ignore:
Timestamp:
03/29/2012 02:15:06 AM (8 years ago)
Author:
dd32
Message:

WP_Filesystem: PemFTP: Detect dl() being disabled in order to avoid any fatals which may be produced when the Sockets extension is not available. Props to kurtpayne for initial patch, Fixes #20187

File:
1 edited

Legend:

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

    r12548 r20311  
    897897}
    898898
    899 $mod_sockets=TRUE;
    900 if (!extension_loaded('sockets')) {
    901     $prefix = (PHP_SHLIB_SUFFIX == 'dll') ? 'php_' : '';
    902     if(!@dl($prefix . 'sockets.' . PHP_SHLIB_SUFFIX)) $mod_sockets=FALSE;
     899$mod_sockets = extension_loaded( 'sockets' );
     900if ( ! $mod_sockets && function_exists( 'dl' ) && is_callable( 'dl' ) ) {
     901    $prefix = ( PHP_SHLIB_SUFFIX == 'dll' ) ? 'php_' : '';
     902    @dl( $prefix . 'sockets.' . PHP_SHLIB_SUFFIX );
     903    $mod_sockets = extension_loaded( 'sockets' );
    903904}
    904905
    905 require_once "class-ftp-".($mod_sockets?"sockets":"pure").".php";
     906require_once "class-ftp-" . ( $mod_sockets ? "sockets" : "pure" ) . ".php";
    906907?>
Note: See TracChangeset for help on using the changeset viewer.