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: http://svn.automattic.com/wordpress/trunk@20311 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
dd32 2012-03-29 02:15:06 +00:00
parent a95f3d243a
commit 3a722f41d7

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";
?>