Skip to content

ext/sockets: socket_cmsg_space() returns int, never null - #23345

Merged
devnexen merged 3 commits into
php:masterfrom
lacatoire:fix/socket-cmsg-space-return-type
Aug 19, 2026
Merged

ext/sockets: socket_cmsg_space() returns int, never null#23345
devnexen merged 3 commits into
php:masterfrom
lacatoire:fix/socket-cmsg-space-return-type

Conversation

@lacatoire

Copy link
Copy Markdown
Member

socket_cmsg_space() is declared ?int, but the nullable return is unreachable.

The stub was written when each failure was a php_error_docref() warning followed by a bare return;, which yields null. PHP 8.0 converted those to ValueError, removing every null exit path. The declaration was not updated.

Every exit is now either RETURN_LONG or RETURN_THROWS. Narrowing ?int to int is a subtype change; no valid call is affected.

The nullable return type dates from the stub introduction, when the
error paths were warnings followed by a bare return. PHP 8.0 turned
them into ValueError, so every exit is now either RETURN_LONG or
RETURN_THROWS.
Comment thread ext/sockets/tests/socket_cmsg_space_return_type.phpt Outdated
Co-authored-by: NickSdot <32384907+NickSdot@users.noreply.github.com>
@devnexen

Copy link
Copy Markdown
Member

You just need an UPGRADING entry but LGTM otherwise

@devnexen

Copy link
Copy Markdown
Member

are you able to merge yourself btw ?

@devnexen
devnexen merged commit a183f11 into php:master Aug 19, 2026
17 of 18 checks passed
@lacatoire
lacatoire deleted the fix/socket-cmsg-space-return-type branch August 19, 2026 14:57
devnexen pushed a commit that referenced this pull request Aug 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants