]> scripts.mit.edu Git - autoinstalls/wordpress.git/blobdiff - wp-admin/includes/class-wp-filesystem-ftpext.php
Wordpress 4.6
[autoinstalls/wordpress.git] / wp-admin / includes / class-wp-filesystem-ftpext.php
index e1202aedd29c9143a5998c52e119c11fddea0263..f337c733c835bd7fd717d69a817b1b4705c1df3b 100644 (file)
@@ -120,13 +120,13 @@ class WP_Filesystem_FTPext extends WP_Filesystem_Base {
                        unlink( $tempfile );
                        return false;
                }
-               
+
                if ( ! @ftp_fget( $this->link, $temp, $file, FTP_BINARY ) ) {
                        fclose( $temp );
                        unlink( $tempfile );
                        return false;
                }
-               
+
                fseek( $temp, 0 ); // Skip back to the start of the file being written to
                $contents = '';
 
@@ -159,8 +159,11 @@ class WP_Filesystem_FTPext extends WP_Filesystem_Base {
        public function put_contents($file, $contents, $mode = false ) {
                $tempfile = wp_tempnam($file);
                $temp = fopen( $tempfile, 'wb+' );
-               if ( ! $temp )
+
+               if ( ! $temp ) {
+                       unlink( $tempfile );
                        return false;
+               }
 
                mbstring_binary_safe_encoding();