Skip to content

Commit

Permalink
Merge f57080f into d5cd42a
Browse files Browse the repository at this point in the history
  • Loading branch information
psafarov committed May 6, 2019
2 parents d5cd42a + f57080f commit 59e27b1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 11 deletions.
8 changes: 0 additions & 8 deletions lib/ResourceOutputStream.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,6 @@ public function __construct($stream, int $chunkSize = null)
continue;
}

if (!\is_resource($stream) || @\feof($stream)) {
throw new StreamException("The stream was closed by the peer");
}

// Error reporting suppressed since fwrite() emits E_WARNING if the pipe is broken or the buffer is full.
// Use conditional, because PHP doesn't like getting null passed
if ($chunkSize) {
Expand Down Expand Up @@ -179,10 +175,6 @@ private function send(string $data, bool $end = false): Promise
return new Success(0);
}

if (!\is_resource($this->resource) || @\feof($this->resource)) {
return new Failure(new StreamException("The stream was closed by the peer"));
}

// Error reporting suppressed since fwrite() emits E_WARNING if the pipe is broken or the buffer is full.
// Use conditional, because PHP doesn't like getting null passed.
if ($this->chunkSize) {
Expand Down
6 changes: 3 additions & 3 deletions test/ResourceOutputStreamTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public function testBrokenPipe()
\fclose($b);

$this->expectException(StreamException::class);
$this->expectExceptionMessage("The stream was closed by the peer");
$this->expectExceptionMessage("Failed to write to stream after multiple attempts");
wait($stream->write("foobar"));
}

Expand All @@ -60,7 +60,7 @@ public function testClosedRemoteSocket()
\fclose($b);

$this->expectException(StreamException::class);
$this->expectExceptionMessage("The stream was closed by the peer");
$this->expectExceptionMessage("Failed to write to stream after multiple attempts");

// The first write still succeeds somehow...
wait($stream->write("foobar"));
Expand Down Expand Up @@ -88,7 +88,7 @@ public function testClosedRemoteSocketWithFork()
\fclose($b);

$this->expectException(StreamException::class);
$this->expectExceptionMessage("The stream was closed by the peer");
$this->expectExceptionMessage("Failed to write to stream after multiple attempts");

try {
// The first write still succeeds somehow...
Expand Down

0 comments on commit 59e27b1

Please sign in to comment.