Skip to content

Commit 46d003b

Browse files
committed
Issue #3036197 by dww: REST FileUploadResource::streamUploadData() can call fclose(FALSE)
(cherry picked from commit 04343d7)
1 parent c212995 commit 46d003b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

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

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

0 commit comments

Comments
 (0)