1--TEST-- 2Test socket_addrinfo_explain() 3--SKIPIF-- 4<?php 5if (!extension_loaded('sockets')) { 6 die('SKIP The sockets extension is not loaded.'); 7} 8--FILE-- 9<?php 10$addrinfo = socket_addrinfo_lookup('127.0.0.1', 2000, array( 11 'ai_family' => AF_INET, 12 'ai_socktype' => SOCK_DGRAM, 13)); 14$result = socket_addrinfo_explain($addrinfo[0]); 15// Musl sets ai_canonname even if AI_CANONNAME is not specified. 16unset($result['ai_canonname']); 17var_dump($result); 18echo "Done"; 19?> 20--EXPECTF-- 21array(5) { 22 ["ai_flags"]=> 23 int(%d) 24 ["ai_family"]=> 25 int(2) 26 ["ai_socktype"]=> 27 int(2) 28 ["ai_protocol"]=> 29 int(%d) 30 ["ai_addr"]=> 31 array(2) { 32 ["sin_port"]=> 33 int(2000) 34 ["sin_addr"]=> 35 string(9) "127.0.0.1" 36 } 37} 38Done 39