1
0
mirror of https://github.com/php/php-src.git synced 2026-04-24 00:18:23 +02:00
Files
archived-php-src/ext/standard/tests/streams/stream_select_null_usec.phpt
T
Damjan Cvetko a4ed17167c Accept null and 0 for microseconds argument in stream_select()
PHP 8.0 did not accept null for the usec argument, PHP 8.1 only
accepts null. This means you can't easily write code compatible
with both without triggering at least a deprecation warning.
Drop the deprecation warning for now.

Closes GH-7617.
2021-11-01 09:09:26 +01:00

36 lines
729 B
PHP

--TEST--
stream_select allows null for microsecond timeout if timeout is null
--FILE--
<?php
$read = [fopen(__FILE__, 'r')];
$write = null;
$except = null;
error_reporting(-1);
set_error_handler(function ($errno, $errstr) {
print $errno . " " . $errstr . "\n";
});
stream_select($read, $write, $except, null, null);
var_dump($read);
print "\n";
stream_select($read, $write, $except, null, 0);
stream_select($read, $write, $except, null, 1);
?>
--EXPECTF--
array(1) {
[0]=>
resource(%d) of type (stream)
}
Fatal error: Uncaught ValueError: stream_select(): Argument #5 ($microseconds) must be null when argument #4 ($seconds) is null in %s
Stack trace:
#0 %s stream_select(Array, NULL, NULL, NULL, 1)
#1 {main}
%s