Skip to content

Delete the files uploaded with each request - #79

Merged
mnapoli merged 1 commit into
masterfrom
fix-uploaded-files-cleanup
Oct 12, 2026
Merged

mnapoli merged 1 commit into
masterfrom
fix-uploaded-files-cleanup

Conversation

@mnapoli

@mnapoli mnapoli commented Oct 12, 2026

Copy link
Copy Markdown
Member

Files uploaded to a Symfony application running with the Bref runtime (not PHP-FPM) were never deleted: they stayed in the Lambda instance's /tmp until it was full, and then everything that writes to /tmp failed.

Bref writes each upload to /tmp/bref_upload_*, and its Psr15Handler deletes those files when the next request starts. But Symfony's HttpFoundationFactory moves every uploaded file to a new temporary file named symfony* (the file is not a native PHP upload), so the cleanup never found it. KernelAdapter now names those files with Bref's prefix.

Bref 3.0.13 is required on Bref 3: before it, the cleanup missed every upload on PHP 8.4 and up (brefphp/bref#2218). The cleanup exists since Bref 2.1.13.

Same fix as brefphp/laravel-bridge#219 for Laravel.

Symfony's HttpFoundationFactory moves every file Bref uploads to a new
temporary file named "symfony*", so the cleanup of Bref's Psr15Handler,
which deletes "bref_upload_*" files, never found them: they stayed in
/tmp until the Lambda instance stopped.

The cleanup exists since Bref 2.1.13, and finds uploads on PHP 8.4 and
up since Bref 3.0.13.
@mnapoli
mnapoli merged commit 3c6a789 into master Oct 12, 2026
10 checks passed
@mnapoli
mnapoli deleted the fix-uploaded-files-cleanup branch October 12, 2026 13:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant