]> scripts.mit.edu Git - autoinstalls/wordpress.git/blobdiff - wp-admin/includes/class-wp-filesystem-ftpsockets.php
WordPress 4.7.1-scripts
[autoinstalls/wordpress.git] / wp-admin / includes / class-wp-filesystem-ftpsockets.php
index 31f225735658baed675d309037f3bd539f64d912..ff0b882414be3c22453a6eed50adb7fb1711039e 100644 (file)
@@ -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();