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

git-svn-id: https://develop.svn.wordpress.org/trunk@20311 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Dion Hulse 2012-03-29 02:15:06 +00:00
parent eeee02b520
commit c024ae710c

View File

@ -896,11 +896,12 @@ class ftp_base {
}
}
$mod_sockets=TRUE;
if (!extension_loaded('sockets')) {
$prefix = (PHP_SHLIB_SUFFIX == 'dll') ? 'php_' : '';
if(!@dl($prefix . 'sockets.' . PHP_SHLIB_SUFFIX)) $mod_sockets=FALSE;
$mod_sockets = extension_loaded( 'sockets' );
if ( ! $mod_sockets && function_exists( 'dl' ) && is_callable( 'dl' ) ) {
$prefix = ( PHP_SHLIB_SUFFIX == 'dll' ) ? 'php_' : '';
@dl( $prefix . 'sockets.' . PHP_SHLIB_SUFFIX );
$mod_sockets = extension_loaded( 'sockets' );
}
require_once "class-ftp-".($mod_sockets?"sockets":"pure").".php";
require_once "class-ftp-" . ( $mod_sockets ? "sockets" : "pure" ) . ".php";
?>