Skip to content

Commit

Permalink
Fix detecting writable from mode
Browse files Browse the repository at this point in the history
Closes #77.
  • Loading branch information
trowski committed Dec 27, 2023
1 parent 0e9dd5e commit 45d8d84
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Internal/QueuedWritesFile.php
Expand Up @@ -38,8 +38,8 @@ public function __construct(
}

$this->queue = new \SplQueue();
$this->writable = $this->mode[0] !== 'r';
$this->position = $this->mode[0] === 'a' ? $this->size : 0;
$this->writable = !\str_contains($this->mode, 'r') || \str_contains($this->mode, '+');
$this->position = \str_contains($this->mode, 'a') ? $this->size : 0;
}

public function __destruct()
Expand Down

0 comments on commit 45d8d84

Please sign in to comment.