-
-
Notifications
You must be signed in to change notification settings - Fork 163
Closed
Description
I just ran into an issue where when you omit the third parameter (how many bytes you want to write to socket), it always writes nothing even though the behaviour should be "to write everything" from the second argument (buffer).
Something like that would fix the issue:
function socket_write($socket, string $buffer, int $length = 0): int
{
error_clear_last();
$result = $length === 0 ? \socket_write($socket, $buffer) : \socket_write($socket, $buffer, $length);
if ($result === false) {
throw SocketsException::createFromPhpError();
}
return $result;
}Temporary workaround in application code is:
\Safe\socket_write($socket, $buffer, strlen($buffer));Metadata
Metadata
Assignees
Labels
No labels