[php-src] PR #24747: Accept an empty packed hints array in socket_addrinfo_lookup()

From: Date: Mon, 26 Oct 2026 15:17:41 +0000
Subject: [php-src] PR #24747: Accept an empty packed hints array in socket_addrinfo_lookup()
Groups: php.git-pulls 
Request: Send a blank email to git-pulls+get-39914@lists.php.net to get a copy of this message
Pull Request: https://github.com/php/php-src/pull/24747 Author: lacatoire Since 8.5, socket_addrinfo_lookup() throws a ValueError for any packed $hints array, including an empty one left by unset() or array_pop(), while the literal [] is accepted. Skip the hints when the array is empty. ### To reproduce ```php <?php $hints = [1]; unset($hints[0]); try { var_dump(count(socket_addrinfo_lookup('127.0.0.1', '80', $hints))); } catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), "\n"; } ``` PHP 8.5.12 (official php:8.5-cli image, sockets extension): Before: ValueError: socket_addrinfo_lookup(): Argument #3 ($hints) must only contain array keys "ai_flags", "ai_socktype", "ai_protocol", or "ai_family" After: int(3), the same result as with [].

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