ARTICLE AD BOX
I upgraded a PHP 7 application to PHP 8. The following code was working before, but no longer:
$options = [ 'http' => [ 'method' => 'POST', 'header' => "Content-Type: application/x-www-form-urlencoded\r\n" . 'Content-Length: ' . strlen($content), 'content' => $content, 'timeout' => 30, ], ]; $context = stream_context_create($options); $stream = fopen($url, 'r', false, $context); $read[] = $stream; $write = null; $except = null; $streamsChanged = stream_select($read, $write, $except, 0, 50000);Now the call to stream_select produces the following error:
Type: ValueError Message: No stream arrays were passedI've tried this same post call using Insomnia with no issue, so it does appear to be an issue with how I'm using PHP 8.
A var_dump of $stream returns type (stream), so the type is correct. I also ran $stream through a is_resource($stream) && get_resource_type($stream) === 'stream' && !feof($stream) check, and it passed.
