﻿id,summary,reporter,owner,description,type,status,priority,milestone,component,version,severity,resolution,keywords,cc
20187,PemFTP Failing to Fall Back to Pure PHP Implementation,merty,dd32,"In /wp-admin/includes/class-ftp.php on line 902:

{{{
if(!@dl($prefix . 'sockets.' . PHP_SHLIB_SUFFIX)) $mod_sockets=FALSE;
}}}

This is the if-check PemFTP uses to try loading php_sockets extension if it is not enabled already, and to fall back to pure PHP implementation of PemFTP when it fails to load it.

However, if dl() is not available either because the PHP is running in Safe Mode or PHP is built with ZTS support, this if-check silently fails and does not update the $mod_sockets variable with the value FALSE.

To fix that, we can first check whether dl() is callable or not and if it is not callable, we can immediately set $mod_sockets to FALSE and make PemFTP use the pure PHP implementation instead of the one that uses php_sockets.

We just need to replace the line above, with the following:

{{{
if(!is_callable('dl') || !@dl($prefix . 'sockets.' . PHP_SHLIB_SUFFIX)) $mod_sockets=FALSE;
}}}",defect (bug),closed,normal,3.4,External Libraries,2.3.1,normal,fixed,has-patch commit,kpayne@…
