From 04343d7d915c8f9d2cfa26039c37248500669c83 Mon Sep 17 00:00:00 2001 From: Alex Pott <alex.a.pott@googlemail.com> Date: Fri, 1 Mar 2019 00:41:34 +0000 Subject: [PATCH] Issue #3036197 by dww: REST FileUploadResource::streamUploadData() can call fclose(FALSE) --- .../file/src/Plugin/rest/resource/FileUploadResource.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/modules/file/src/Plugin/rest/resource/FileUploadResource.php b/core/modules/file/src/Plugin/rest/resource/FileUploadResource.php index 8efbb92d5d94..3b1f5f321618 100644 --- a/core/modules/file/src/Plugin/rest/resource/FileUploadResource.php +++ b/core/modules/file/src/Plugin/rest/resource/FileUploadResource.php @@ -325,8 +325,8 @@ protected function streamUploadData() { fclose($temp_file); } else { - // Close the file streams. - fclose($temp_file); + // Close the input file stream since we can't proceed with the upload. + // Don't try to close $temp_file since it's FALSE at this point. fclose($file_data); $this->logger->error('Temporary file "%path" could not be opened for file upload', ['%path' => $temp_file_path]); throw new HttpException(500, 'Temporary file could not be opened'); -- GitLab