From 921bd889860cf697a022642e628d086c9048ca67 Mon Sep 17 00:00:00 2001 From: David Grudl Date: Wed, 2 Jun 2021 16:42:00 +0200 Subject: [PATCH] fixed fopen mode [Closes #10] --- src/SafeStream/SafeStream.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SafeStream/SafeStream.php b/src/SafeStream/SafeStream.php index 7239f33..3de587c 100644 --- a/src/SafeStream/SafeStream.php +++ b/src/SafeStream/SafeStream.php @@ -86,7 +86,7 @@ public function stream_open(string $path, string $mode, int $options): bool $this->deleteFile = true; } elseif ($mode[0] === 'w' || $mode[0] === 'a' || $mode[0] === 'c') { - if ($this->checkAndLock($this->handle = @fopen($path, 'x' . $flag, $use_path), LOCK_EX)) { // intentionally @ + if ($this->checkAndLock($this->handle = @fopen($path, 'x+' . $flag, $use_path), LOCK_EX)) { // intentionally @ $this->deleteFile = true; } elseif (!$this->checkAndLock($this->handle = fopen($path, 'a+' . $flag, $use_path), LOCK_EX)) {