diff --git a/wp-admin/includes/class-wp-filesystem-ftpext.php b/wp-admin/includes/class-wp-filesystem-ftpext.php index b48a125162..12d56aa33b 100644 --- a/wp-admin/includes/class-wp-filesystem-ftpext.php +++ b/wp-admin/includes/class-wp-filesystem-ftpext.php @@ -152,6 +152,8 @@ class WP_Filesystem_FTPext{ $type = isset($this->filetypes[ $extension ]) ? $this->filetypes[ $extension ] : FTP_ASCII; } $temp = tmpfile(); + if ( ! $temp ) + return false; if( ! @ftp_fget($this->link,$temp,$file,$type,$resumepos) ) return false; fseek($temp, 0); //Skip back to the start of the file being written to @@ -171,6 +173,8 @@ class WP_Filesystem_FTPext{ $type = isset($this->filetypes[ $extension ]) ? $this->filetypes[ $extension ] : FTP_ASCII; } $temp = tmpfile(); + if ( ! $temp ) + return false; fwrite($temp,$contents); fseek($temp, 0); //Skip back to the start of the file being written to $ret = @ftp_fput($this->link,$file,$temp,$type); diff --git a/wp-admin/includes/class-wp-filesystem-ftpsockets.php b/wp-admin/includes/class-wp-filesystem-ftpsockets.php index fbac7b7e41..11d4e83c22 100644 --- a/wp-admin/includes/class-wp-filesystem-ftpsockets.php +++ b/wp-admin/includes/class-wp-filesystem-ftpsockets.php @@ -159,6 +159,8 @@ class WP_Filesystem_ftpsockets{ } $this->ftp->SetType($type); $temp = tmpfile(); + if ( ! $temp ) + return false; if ( ! $this->ftp->fget($temp, $file) ) { fclose($temp); return ''; //Blank document, File does exist, Its just blank. @@ -183,6 +185,8 @@ class WP_Filesystem_ftpsockets{ $this->ftp->SetType($type); $temp = tmpfile(); + if ( ! $temp ) + return false; fwrite($temp,$contents); fseek($temp, 0); //Skip back to the start of the file being written to $ret = $this->ftp->fput($file, $temp);