[php-src] PR #25591: Fix stream_socket_sendto() returning -1 instead of false on failure

From: Date: Thu, 19 Nov 2026 15:19:16 +0000
Subject: [php-src] PR #25591: Fix stream_socket_sendto() returning -1 instead of false on failure
Groups: php.git-pulls 
Request: Send a blank email to git-pulls+get-40812@lists.php.net to get a copy of this message
Pull Request: https://github.com/php/php-src/pull/25591 Author: lacatoire stream_socket_sendto() is declared int|false and documented as returning false on failure, but it returned the raw -1 of the transport for every error except an unparseable address. -1 is truthy, so a caller testing === false missed nearly every failure. It now returns false, like stream_socket_recvfrom(). Callers testing < 0 need to be updated, hence the UPGRADING entry. ### To reproduce ```php <?php $server = stream_socket_server('udp://127.0.0.1:0', $errno, $errstr, STREAM_SERVER_BIND); var_dump(@stream_socket_sendto($server, 'x')); var_dump(stream_socket_sendto(fopen('php://memory', 'r+'), 'x')); ``` Before (PHP 8.4.26 and 8.5.12): ``` int(-1) int(-1) ``` After: ``` bool(false) bool(false) ```

« previous php.git-pulls (#40812) next »