Skip to content

Commit

Permalink
fix: Keep underlying file instance in UploadedBase64EncodedFile to av…
Browse files Browse the repository at this point in the history
…oid its phyisical file will be cleaned up
  • Loading branch information
hshn committed Dec 6, 2023
1 parent cc50bb5 commit 7ffcecc
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/HttpFoundation/File/UploadedBase64EncodedFile.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
*/
class UploadedBase64EncodedFile extends UploadedFile
{
private Base64EncodedFile $underlying;

/**
* @param Base64EncodedFile $file
* @param string $originalName
Expand All @@ -18,10 +20,12 @@ class UploadedBase64EncodedFile extends UploadedFile
*/
public function __construct(Base64EncodedFile $file, $originalName = '', $mimeType = null, $size = null)
{
parent::__construct($file->getPathname(), $originalName ?: $file->getFilename(), $mimeType, null, true);

if ($size !== null) {
trigger_error('The $size argument is removed since Symfony 5.0 and we will removed it in 6.0.', E_USER_DEPRECATED);
}

parent::__construct($file->getPathname(), $originalName ?: $file->getFilename(), $mimeType, null, true);
$this->underlying = $file;
}
}

0 comments on commit 7ffcecc

Please sign in to comment.