PemFTP Failing to Fall Back to Pure PHP Implementation
|Reported by:||merty||Owned by:||dd32|
|Component:||External Libraries||Keywords:||has-patch commit|
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;
Change History (15)
- Keywords commit added; dev-feedback removed
- Milestone changed from Awaiting Review to 3.4
comment:10 dd32 — 2 years ago
- Owner set to dd32
- Resolution set to fixed
- Status changed from new to closed