File tree Expand file tree Collapse file tree 3 files changed +23
-7
lines changed
Expand file tree Collapse file tree 3 files changed +23
-7
lines changed Original file line number Diff line number Diff line change @@ -2802,14 +2802,16 @@ PHP_FUNCTION(socket_addrinfo_lookup)
28022802 // Some platforms support also PF_LOCAL/AF_UNIX (e.g. FreeBSD) but the security concerns implied
28032803 // make it not worth handling it (e.g. unwarranted write permissions on the socket).
28042804 // Note existing socket_addrinfo* api already forbid such case.
2805+ if (val != AF_UNSPEC ) {
28052806#ifdef HAVE_IPV6
2806- if (val != AF_INET && val != AF_INET6 ) {
2807- zend_argument_value_error (3 , "\"ai_family\" key must be AF_INET or AF_INET6" );
2807+ if (val != AF_INET && val != AF_INET6 ) {
2808+ zend_argument_value_error (3 , "\"ai_family\" key must be AF_INET or AF_INET6" );
28082809#else
2809- if (val != AF_INET ) {
2810- zend_argument_value_error (3 , "\"ai_family\" key must be AF_INET" );
2810+ if (val != AF_INET ) {
2811+ zend_argument_value_error (3 , "\"ai_family\" key must be AF_INET" );
28112812#endif
2812- RETURN_THROWS ();
2813+ RETURN_THROWS ();
2814+ }
28132815 }
28142816 hints .ai_family = (int )val ;
28152817 } else {
@@ -2833,7 +2835,11 @@ PHP_FUNCTION(socket_addrinfo_lookup)
28332835 zend_hash_real_init_packed (Z_ARRVAL_P (return_value ));
28342836
28352837 for (rp = result ; rp != NULL ; rp = rp -> ai_next ) {
2836- if (rp -> ai_family != AF_UNSPEC ) {
2838+ if (rp -> ai_family == AF_INET
2839+ #ifdef HAVE_IPV6
2840+ || rp -> ai_family != AF_INET6
2841+ #endif
2842+ ) {
28372843 zval zaddr ;
28382844
28392845 object_init_ex (& zaddr , address_info_ce );
Original file line number Diff line number Diff line change 1919 */
2020const AF_INET6 = UNKNOWN ;
2121#endif
22+ #ifdef AF_UNSPEC
23+ /**
24+ * @var int
25+ * @cvalue AF_UNSPEC
26+ */
27+ const AF_UNSPEC = UNKNOWN ;
28+ #endif
2229#ifdef AF_DIVERT
2330/**
2431 * @var int
You can’t perform that action at this time.
0 commit comments