Skip to content

Commit 7017e83

Browse files
committed
Backport CI: Fix gh20532.phpt on FreeBSD (#24424)
FreeBSD's getaddrinfo() may fall back to name resolution when numeric address parsing fails. Set AI_NUMERICHOST to keep the test deterministic. (cherry picked from commit c5093f7) Closes #24424
1 parent 68aa337 commit 7017e83

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

‎ext/sockets/tests/gh20532.phpt‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ sockets
66
<?php
77
$error_code = 0;
88
var_dump(socket_addrinfo_lookup(".whynot", null, [], $error_code) === false && in_array($error_code, [EAI_NONAME, EAI_FAIL], true));
9-
var_dump(socket_addrinfo_lookup("2001:db8::1", null, ['ai_family' => AF_INET], $error_code) === false && in_array($error_code, [EAI_FAMILY, EAI_ADDRFAMILY, EAI_NONAME, EAI_NODATA]));
9+
// Prevent name resolution on platforms that do not recognize an address of the wrong family.
10+
var_dump(socket_addrinfo_lookup("2001:db8::1", null, ['ai_family' => AF_INET, 'ai_flags' => AI_NUMERICHOST], $error_code) === false && in_array($error_code, [EAI_FAMILY, EAI_ADDRFAMILY, EAI_NONAME, EAI_NODATA]));
1011
var_dump(socket_addrinfo_lookup("example.com", "http", ['ai_socktype' => SOCK_RAW, 'ai_flags' => 2147483647], $error_code) === false && in_array($error_code, [EAI_SOCKTYPE, EAI_SERVICE, EAI_BADFLAGS, EAI_NONAME]));
1112
?>
1213
--EXPECT--

0 commit comments

Comments
 (0)