summaryrefslogtreecommitdiffstats
path: root/php-react-stream-php8.patch
diff options
context:
space:
mode:
Diffstat (limited to 'php-react-stream-php8.patch')
-rw-r--r--php-react-stream-php8.patch34
1 files changed, 34 insertions, 0 deletions
diff --git a/php-react-stream-php8.patch b/php-react-stream-php8.patch
new file mode 100644
index 0000000..b973488
--- /dev/null
+++ b/php-react-stream-php8.patch
@@ -0,0 +1,34 @@
+diff -up ./src/WritableResourceStream.php.php8 ./src/WritableResourceStream.php
+--- ./src/WritableResourceStream.php.php8 2021-04-07 16:22:09.048553209 +0200
++++ ./src/WritableResourceStream.php 2021-04-07 16:22:14.797526978 +0200
+@@ -117,10 +117,15 @@ final class WritableResourceStream exten
+ $error = $errstr;
+ });
+
+- if ($this->writeChunkSize === -1) {
+- $sent = \fwrite($this->stream, $this->data);
++ if (is_resource($this->stream)) {
++ if ($this->writeChunkSize === -1) {
++ $sent = \fwrite($this->stream, $this->data);
++ } else {
++ $sent = \fwrite($this->stream, $this->data, $this->writeChunkSize);
++ }
+ } else {
+- $sent = \fwrite($this->stream, $this->data, $this->writeChunkSize);
++ $sent = 0;
++ $error = 'this is not a valid stream resource';
+ }
+
+ \restore_error_handler();
+diff -up ./tests/WritableStreamResourceTest.php.php8 ./tests/WritableStreamResourceTest.php
+--- ./tests/WritableStreamResourceTest.php.php8 2021-04-07 16:18:25.234574523 +0200
++++ ./tests/WritableStreamResourceTest.php 2021-04-07 16:18:44.985484393 +0200
+@@ -508,7 +508,7 @@ class WritableResourceStreamTest extends
+ $buffer->handleWrite();
+
+ $this->assertInstanceOf('Exception', $error);
+- $this->assertSame('Unable to write to stream: fwrite(): send of 3 bytes failed with errno=32 Broken pipe', $error->getMessage());
++ $this->assertEqualsIgnoringCase('Unable to write to stream: fwrite(): send of 3 bytes failed with errno=32 Broken pipe', $error->getMessage());
+ }
+
+ private function createWriteableLoopMock()