Skip to content

Commit

Permalink
cleanup file regardless of the stream
Browse files Browse the repository at this point in the history
Signed-off-by: katsuren <t@k2rn.com>
  • Loading branch information
k2rn authored and Ocramius committed Jul 6, 2022
1 parent 5773e76 commit 197f195
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/UploadedFile.php
Expand Up @@ -190,9 +190,9 @@ public function moveTo($targetPath) : void

if ($this->stream instanceof StreamInterface) {
$this->stream->close();
if (is_string($this->file) && file_exists($this->file)) {
unlink($this->file);
}
}
if (is_string($this->file) && file_exists($this->file)) {
unlink($this->file);
}
break;
default:
Expand Down

2 comments on commit 197f195

@triopsi
Copy link

@triopsi triopsi commented on 197f195 Jul 7, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With this change you break many PHPUnit test cases that need to use the UploadedFile object. Only if the object is used multiple times.
$data = array( 'uploadFiles' => array(new UploadedFile( TESTS . '/TestFiles/ABC.pdf', 0, UPLOAD_ERR_OK, 'ABC.pdf', 'application/pdf')), ); $this->post( 'documents/add', $data );
Is there an alternative to still save PHPUnit test cases?

@froschdesign
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@k2rn
Please create an issue report to report the problem.
Thanks in advance! 👍🏻

Please sign in to comment.