Skip to content

Commit 045731c

Browse files
committed
Always use in-memory streams in binary mode for GridFS buffering
1 parent 1b20707 commit 045731c

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/GridFS/ReadableStream.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ private function initEmptyBuffer()
197197
fclose($this->buffer);
198198
}
199199

200-
$this->buffer = fopen("php://temp", "w+");
200+
$this->buffer = fopen("php://memory", "w+b");
201201
$this->bufferEmpty = true;
202202
$this->bufferFresh = true;
203203
}

src/GridFS/WritableStream.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ public function __construct(CollectionWrapper $collectionWrapper, $filename, arr
7676

7777
$this->chunkSize = $options['chunkSizeBytes'];
7878
$this->collectionWrapper = $collectionWrapper;
79-
$this->buffer = fopen('php://temp', 'w+');
79+
$this->buffer = fopen('php://memory', 'w+b');
8080
$this->ctx = hash_init('md5');
8181

8282
$this->file = [

0 commit comments

Comments
 (0)