Skip to content

Accept an empty packed hints array in socket_addrinfo_lookup() - #24747

Open
lacatoire wants to merge 1 commit into
php:PHP-8.5from
lacatoire:fix/socket-addrinfo-empty-packed-hints
Open

lacatoire wants to merge 1 commit into
php:PHP-8.5from
lacatoire:fix/socket-addrinfo-empty-packed-hints

Conversation

@lacatoire

@lacatoire lacatoire commented Oct 26, 2026 •

Copy link
Copy Markdown
Member

socket_addrinfo_lookup() throws a ValueError on 8.5 for an empty packed $hints (left by unset()), while [] is accepted. Skip empty hints.

To reproduce

$hints = [1];
unset($hints[0]);
var_dump(count(socket_addrinfo_lookup('127.0.0.1', '80', $hints)));

PHP 8.5.12: before, ValueError: socket_addrinfo_lookup(): Argument #3 ($hints) must only contain array keys ...; after, int(3) (same as with []).

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.

1 participant