Skip to content

Commit 6caf83f

Browse files
committed
Suppress warning on fwrite() on StringWriter when process dies prematurely
1 parent e053a20 commit 6caf83f

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/Stream/StringWriter.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,12 @@ public function write($auto_close=true)
4545
return false;
4646
} else {
4747
$chunk = substr($this->data, $this->position, $this->buffer_size);
48-
$bytes_written = fwrite($this->dest_stream, $chunk);
48+
$bytes_written = @fwrite($this->dest_stream, $chunk);
49+
50+
if ($bytes_written === false) {
51+
$bytes_written = 0;
52+
}
53+
4954
$this->position += $bytes_written;
5055
return $bytes_written;
5156
}

0 commit comments

Comments
 (0)