Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/VirtualFileSystem/Wrapper/FileHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ public function atEof()
public function truncate($newSize = 0)
{
$this->position(0);
$newData = substr($this->file->data(), 0, $newSize);
$newData = substr($this->file->data() ? $this->file->data() : '', 0, $newSize);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can confirm that this fixes the issue. Maybe we could use null coalescing operator?

$newData = false === $newData ? '' : $newData;
$this->file->setData($newData);
$this->file->setModificationTime(time());
Expand Down