Skip to content

Commit c27b95b

Browse files
committed
add tests
1 parent 64f6042 commit c27b95b

File tree

3 files changed

+30
-1
lines changed

3 files changed

+30
-1
lines changed

ext/sockets/sockets.stub.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2116,6 +2116,15 @@
21162116
* @cvalue EAI_ADDRFAMILY
21172117
*/
21182118
const EAI_ADDRFAMILY = UNKNOWN;
2119+
#else
2120+
#ifdef EAI_FAMILY
2121+
/**
2122+
* @var int
2123+
* @cvalue EAI_FAMILY
2124+
*/
2125+
const EAI_ADDRFAMILY = UNKNOWN;
2126+
#else
2127+
#endif
21192128
#endif
21202129
#ifdef EAI_SYSTEM
21212130
/**

ext/sockets/sockets_arginfo.h

Lines changed: 4 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ext/sockets/tests/gh20532.phpt

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
--TEST--
2+
GH-20562 - socket_addrinfo_lookup() returns error codes on resolution failures.
3+
--EXTENSIONS--
4+
sockets
5+
--FILE--
6+
<?php
7+
var_dump(socket_addrinfo_lookup(".whynot") == EAI_NONAME);
8+
var_dump(in_array(socket_addrinfo_lookup("2001:db8::1", null, ['ai_family' => AF_INET]), [EAI_FAMILY, EAI_ADDRFAMILY, EAI_NONAME, EAI_NODATA]));
9+
var_dump(in_array(socket_addrinfo_lookup("example.com", "http", ['ai_socktype' => SOCK_RAW, 'ai_flags' => 2147483647]), [EAI_SOCKTYPE, EAI_SERVICE, EAI_BADFLAGS, EAI_NONAME]));
10+
//var_dump(socket_addrinfo_lookup("2001:db8::1", null, ['ai_family' => AF_INET]));
11+
//var_dump(socket_addrinfo_lookup("example.com", "http", ['ai_socktype' => SOCK_RAW, 'ai_flags' => 2147483647]));
12+
?>
13+
--EXPECT--
14+
bool(true)
15+
bool(true)
16+
bool(true)
17+

0 commit comments

Comments
 (0)