Skip to content

Commit

Permalink
Accept null and 0 for microseconds argument in stream_select()
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
zobo authored and nikic committed Nov 1, 2021
1 parent d49f550 commit a4ed171
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 4 deletions.
4 changes: 1 addition & 3 deletions ext/standard/streamsfuncs.c
Original file line number Diff line number Diff line change
Expand Up @@ -790,9 +790,7 @@ PHP_FUNCTION(stream_select)
PHP_SAFE_MAX_FD(max_fd, max_set_count);

if (secnull && !usecnull) {
if (usec == 0) {
php_error_docref(NULL, E_DEPRECATED, "Argument #5 ($microseconds) should be null instead of 0 when argument #4 ($seconds) is null");
} else {
if (usec != 0) {
zend_argument_value_error(5, "must be null when argument #4 ($seconds) is null");
RETURN_THROWS();
}
Expand Down
1 change: 0 additions & 1 deletion ext/standard/tests/streams/stream_select_null_usec.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ array(1) {
resource(%d) of type (stream)
}

8192 stream_select(): Argument #5 ($microseconds) should be null instead of 0 when argument #4 ($seconds) is null

Fatal error: Uncaught ValueError: stream_select(): Argument #5 ($microseconds) must be null when argument #4 ($seconds) is null in %s
Stack trace:
Expand Down

0 comments on commit a4ed171

Please sign in to comment.