Skip to content

Commit 242f5d3

Browse files
committed
ipv6 or not ipv6..
1 parent 8ac3513 commit 242f5d3

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

ext/sockets/sockets.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2777,8 +2777,13 @@ PHP_FUNCTION(socket_addrinfo_lookup)
27772777
// Some platforms support also PF_LOCAL/AF_UNIX (e.g. FreeBSD) but the security concerns implied
27782778
// make it not worth handling it (e.g. unwarranted write permissions on the socket).
27792779
// Note existing socket_addrinfo* api already forbid such case.
2780+
#ifdef HAVE_IPV6
27802781
if (val != AF_INET && val != AF_INET6) {
27812782
zend_argument_value_error(3, "\"ai_family\" key must be AF_INET or AF_INET6");
2783+
#else
2784+
if (val != AF_INET) {
2785+
zend_argument_value_error(3, "\"ai_family\" key must be AF_INET");
2786+
#endif
27822787
RETURN_THROWS();
27832788
}
27842789
hints.ai_family = (int)val;

ext/sockets/tests/socket_getaddrinfo_error.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ socket_addrinfo_lookup(): Argument #3 ($hints) "ai_family" key must be of type i
110110
socket_addrinfo_lookup(): Argument #3 ($hints) "ai_socktype" key must be of type int, stdClass given
111111
socket_addrinfo_lookup(): Argument #3 ($hints) "ai_flags" key must be of type int, stdClass given
112112
socket_addrinfo_lookup(): Argument #3 ($hints) "ai_protocol" key must be of type int, stdClass given
113-
socket_addrinfo_lookup(): Argument #3 ($hints) "ai_family" key must be AF_INET or AF_INET6
113+
socket_addrinfo_lookup(): Argument #3 ($hints) "ai_family" key must be AF_INET%A
114114
socket_addrinfo_lookup(): Argument #3 ($hints) "ai_socktype" key must be between 0 and %d
115115
socket_addrinfo_lookup(): Argument #3 ($hints) "ai_flags" key must be between 0 and %d
116116
socket_addrinfo_lookup(): Argument #3 ($hints) "ai_protocol" key must be between 0 and %d

0 commit comments

Comments
 (0)