Commit c5093f7caae for php
commit c5093f7caaebeafb6d00e67d4e7d899a90931b44
Author: Weilin Du <weilindu@php.net>
Date: Mon Oct 19 21:50:21 2026 +0800
CI: Fix gh20532.phpt on FreeBSD (#24424)
FreeBSD's getaddrinfo() does not immediately return errors from
numeric address parsing and can fall back to name resolution.
diff --git a/ext/sockets/tests/gh20532.phpt b/ext/sockets/tests/gh20532.phpt
index 2bec6953dac..35030ecd279 100644
--- a/ext/sockets/tests/gh20532.phpt
+++ b/ext/sockets/tests/gh20532.phpt
@@ -6,7 +6,8 @@
<?php
$error_code = 0;
var_dump(socket_addrinfo_lookup(".whynot", null, [], $error_code) === false && in_array($error_code, [EAI_NONAME, EAI_FAIL], true));
-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]));
+// Prevent name resolution on platforms that do not recognize an address of the wrong family.
+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]));
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]));
?>
--EXPECT--