[wp-trac] [WordPress Trac] #20187: PemFTP Failing to Fall Back to Pure PHP Implementation

WordPress Trac wp-trac at lists.automattic.com
Tue Mar 6 21:39:54 UTC 2012


#20187: PemFTP Failing to Fall Back to Pure PHP Implementation
--------------------------------+-----------------------------
 Reporter:  merty               |      Owner:
     Type:  defect (bug)        |     Status:  new
 Priority:  normal              |  Milestone:  Awaiting Review
Component:  External Libraries  |    Version:  3.3.1
 Severity:  normal              |   Keywords:  dev-feedback
--------------------------------+-----------------------------
 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;
 }}}

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/20187>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list