Skip to content

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

Open
lacatoire wants to merge 2 commits into
php:masterfrom
lacatoire:fix/socket-cmsg-space-return-type
Open

ext/sockets: socket_cmsg_space() returns int, never null#23345
lacatoire wants to merge 2 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

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