X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/138998bbd8f7a1ac38b2f1eacbdf7cd522be4b13..e3ff8f35458a959c1879c0a4976701ed8dcfe651:/wp-admin/includes/class-wp-filesystem-ftpsockets.php diff --git a/wp-admin/includes/class-wp-filesystem-ftpsockets.php b/wp-admin/includes/class-wp-filesystem-ftpsockets.php index 29ac7888..ff0b8824 100644 --- a/wp-admin/includes/class-wp-filesystem-ftpsockets.php +++ b/wp-admin/includes/class-wp-filesystem-ftpsockets.php @@ -39,7 +39,7 @@ class WP_Filesystem_ftpsockets extends WP_Filesystem_Base { if ( empty($opt['port']) ) $this->options['port'] = 21; else - $this->options['port'] = $opt['port']; + $this->options['port'] = (int) $opt['port']; if ( empty($opt['hostname']) ) $this->errors->add('empty_hostname', __('FTP hostname is required')); @@ -121,8 +121,10 @@ class WP_Filesystem_ftpsockets extends WP_Filesystem_Base { $temp = wp_tempnam( $file ); - if ( ! $temphandle = fopen($temp, 'w+') ) + if ( ! $temphandle = fopen( $temp, 'w+' ) ) { + unlink( $temp ); return false; + } mbstring_binary_safe_encoding(); @@ -342,7 +344,7 @@ class WP_Filesystem_ftpsockets extends WP_Filesystem_Base { * @return bool */ public function exists( $file ) { - $list = $this->ftp->rawlist( $file, '-a' ); + $list = $this->ftp->nlist( $file ); if ( empty( $list ) && $this->is_dir( $file ) ) { return true; // File is an empty directory.