fix: use php://temp instead of php://memory for multi-part upload buffer

this should reduce potential memory issues if the limit is set very high

Signed-off-by: Robin Appelman <robin@icewind.nl>
pull/49352/head
Robin Appelman 2024-11-18 17:35:09 +07:00
parent 7bc21d8a34
commit 7da8951c57
No known key found for this signature in database
GPG Key ID: 42B69D8A64526EFB
1 changed files with 1 additions and 1 deletions

@ -144,7 +144,7 @@ trait S3ObjectTrait {
// ($psrStream->isSeekable() && $psrStream->getSize() !== null) evaluates to true for a On-Seekable stream
// so the optimisation does not apply
$buffer = new Psr7\Stream(fopen('php://memory', 'rwb+'));
$buffer = new Psr7\Stream(fopen('php://temp', 'rwb+'));
Utils::copyToStream($psrStream, $buffer, $this->putSizeLimit);
$buffer->seek(0);
if ($buffer->getSize() < $this->putSizeLimit) {