Skip to content

Commit

Permalink
fix: use php://temp instead of php://memory for multi-part upload buffer
Browse files Browse the repository at this point in the history
this should reduce potential memory issues if the limit is set very high

Signed-off-by: Robin Appelman <[email protected]>
  • Loading branch information
icewind1991 committed Nov 18, 2024
1 parent 8995272 commit 573825c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/private/Files/ObjectStore/S3ObjectTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ public function writeObject($urn, $stream, ?string $mimetype = null) {

// ($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) {
Expand Down

0 comments on commit 573825c

Please sign in to comment.