Merge pull request #16444 from nextcloud/backport/16440/stable16

[stable16] Fix File#putContents(string) on ObjectStorage
This commit is contained in:
Roeland Jago Douma 2019-07-18 08:08:54 +02:00 committed by GitHub
commit 158ca6f03c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 4 deletions

View File

@ -410,10 +410,10 @@ class ObjectStoreStorage extends \OC\Files\Storage\Common {
}
public function file_put_contents($path, $data) {
$stream = fopen('php://temp', 'r+');
fwrite($stream, $data);
rewind($stream);
return $this->writeStream($path, $stream, strlen($data)) > 0;
$handle = $this->fopen($path, 'w+');
fwrite($handle, $data);
fclose($handle);
return true;
}
public function writeStream(string $path, $stream, int $size = null): int {