Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions stubs/core.stub
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,17 @@ function str_ireplace($search, $replace, $subject, ?int &$count = null) {}
*/
function stream_select(?array &$read, ?array &$write, ?array &$except, ?int $seconds, ?int $microseconds = null) {}

/**
* @param int $error_code
* @param-out int $error_code
* @param string $error_message
* @param-out string $error_message
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What are these set to if the call does not fail?

Copy link
Author

@MatTheCat MatTheCat Mar 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$error_code will be zero and $error_message an empty string.

$ php -r 'var_dump(stream_socket_client("udp://127.0.0.1:13", $errorCode, $errorMessage), $errorCode, $errorMessage);'
resource(5) of type (stream)
int(0)
string(0) ""

EDIT it seems you can get those values even if the call fails: https://3v4l.org/TmSQQ

* @param int-mask<1, 2, 4> $flags
* @param resource|null $context
* @return resource|false
*/
function stream_socket_client(string $address, &$error_code = null, &$error_message = null, ?float $timeout = null, int $flags = 4, $context = null) {}

/**
* @param resource $stream
* @param-out 0|1 $would_block
Expand Down
Loading