Skip to content

Instantly share code, notes, and snippets.

@elazar
Last active July 13, 2021 20:11
Show Gist options
  • Save elazar/a933a1e575cce9fe83cf08562db8fe0e to your computer and use it in GitHub Desktop.
Save elazar/a933a1e575cce9fe83cf08562db8fe0e to your computer and use it in GitHub Desktop.
react/stream
PHP Fatal error: Uncaught ValueError: No stream arrays were passed in vendor/react/event-loop/src/StreamSelectLoop.php:290
Stack trace:
#0 vendor/react/event-loop/src/StreamSelectLoop.php(290): stream_select()
#1 vendor/react/event-loop/src/StreamSelectLoop.php(231): React\EventLoop\StreamSelectLoop->streamSelect()
#2 vendor/react/event-loop/src/StreamSelectLoop.php(212): React\EventLoop\StreamSelectLoop->waitForStreamActivity()
#3 vendor/react/event-loop/src/Loop.php(55): React\EventLoop\StreamSelectLoop->run()
#4 [internal function]: React\EventLoop\Loop::React\EventLoop\{closure}()
#5 {main}
thrown in vendor/react/event-loop/src/StreamSelectLoop.php on line 290
<?php
use React\Stream\ReadableResourceStream;
use React\Stream\WritableResourceStream;
function wrapper()
{
$resource = fopen('php://memory', 'r+');
$buffer = new ReadableResourceStream($resource);
$buffer->on('data', function ($chunk) {
var_dump($chunk);
});
$stream = new WritableResourceStream($resource);
$stream->on('close', function () use ($buffer) {
$buffer->close();
});
return $stream;
}
$write = wrapper();
$write->write('foo');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment