Skip to content

Commit 45d8d84

Browse files
committed
Fix detecting writable from mode
Closes #77.
1 parent 0e9dd5e commit 45d8d84

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Internal/QueuedWritesFile.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ public function __construct(
3838
}
3939

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

4545
public function __destruct()

0 commit comments

Comments
 (0)