Skip to content

Commit

Permalink
Unset ai_canonname field in dump
Browse files Browse the repository at this point in the history
Okay, looks like ai_canonname does not get set on macos even if
AI_CANONNAME is specified, so canonicalize this in the other
direction instead and unset ai_canonname if it is present.
  • Loading branch information
nikic committed Aug 5, 2020
1 parent 25bdf9d commit b69a98c
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions ext/sockets/tests/socket_addrinfo_explain.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,14 @@ if (!extension_loaded('sockets')) {
$addrinfo = socket_addrinfo_lookup('127.0.0.1', 2000, array(
'ai_family' => AF_INET,
'ai_socktype' => SOCK_DGRAM,
'ai_flags' => AI_CANONNAME,
));
var_dump(socket_addrinfo_explain($addrinfo[0]));
$result = socket_addrinfo_explain($addrinfo[0]);
// Musl sets ai_canonname even if AI_CANONNAME is not specified.
unset($result['ai_canonname']);
var_dump($result);
echo "Done";
--EXPECTF--
array(6) {
array(5) {
["ai_flags"]=>
int(%d)
["ai_family"]=>
Expand All @@ -24,8 +26,6 @@ array(6) {
int(2)
["ai_protocol"]=>
int(%d)
["ai_canonname"]=>
string(9) "127.0.0.1"
["ai_addr"]=>
array(2) {
["sin_port"]=>
Expand Down

0 comments on commit b69a98c

Please sign in to comment.