Skip to content

Commit

Permalink
fixed fopen mode [Closes #10]
Browse files Browse the repository at this point in the history
  • Loading branch information
dg committed Jun 2, 2021
1 parent 8a858b3 commit 921bd88
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/SafeStream/SafeStream.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down

0 comments on commit 921bd88

Please sign in to comment.