Skip to content

Commit 04343d7

Browse files
committed
Issue #3036197 by dww: REST FileUploadResource::streamUploadData() can call fclose(FALSE)
1 parent 0b6e897 commit 04343d7

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

core/modules/file/src/Plugin/rest/resource/FileUploadResource.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -325,8 +325,8 @@ protected function streamUploadData() {
325325
fclose($temp_file);
326326
}
327327
else {
328-
// Close the file streams.
329-
fclose($temp_file);
328+
// Close the input file stream since we can't proceed with the upload.
329+
// Don't try to close $temp_file since it's FALSE at this point.
330330
fclose($file_data);
331331
$this->logger->error('Temporary file "%path" could not be opened for file upload', ['%path' => $temp_file_path]);
332332
throw new HttpException(500, 'Temporary file could not be opened');

0 commit comments

Comments
 (0)