diff --git a/Zend/Optimizer/zend_func_infos.h b/Zend/Optimizer/zend_func_infos.h index 6dc947e3cc839..47bd2a892da55 100644 --- a/Zend/Optimizer/zend_func_infos.h +++ b/Zend/Optimizer/zend_func_infos.h @@ -525,9 +525,7 @@ static const func_info_t func_infos[] = { F1("md5_file", MAY_BE_STRING|MAY_BE_FALSE), F1("sha1", MAY_BE_STRING), F1("sha1_file", MAY_BE_STRING|MAY_BE_FALSE), -#if defined(HAVE_INET_NTOP) F1("inet_ntop", MAY_BE_STRING|MAY_BE_FALSE), -#endif #if defined(HAVE_INET_PTON) F1("inet_pton", MAY_BE_STRING|MAY_BE_FALSE), #endif diff --git a/configure.ac b/configure.ac index c7aeeb3584f39..bde53e10cc82d 100644 --- a/configure.ac +++ b/configure.ac @@ -609,7 +609,6 @@ getgrnam_r \ getpwuid_r \ getwd \ glob \ -inet_ntop \ inet_pton \ localtime_r \ lchown \ @@ -646,6 +645,11 @@ memmem \ memrchr \ ) +AC_CHECK_FUNCS(inet_ntop,[],[ + AC_MSG_ERROR([Cannot find inet_ntop which is required]) +] +) + dnl Check for strerror_r, and if its a POSIX-compatible or a GNU specific version. AC_FUNC_STRERROR_R diff --git a/ext/ftp/ftp.c b/ext/ftp/ftp.c index 1ac3cccbacb7f..6409153dd6c33 100644 --- a/ext/ftp/ftp.c +++ b/ext/ftp/ftp.c @@ -56,10 +56,6 @@ #include #endif -#ifndef HAVE_INET_NTOP -#error inet_ntop unsupported on this platform -#endif - #include "ftp.h" #include "ext/standard/fsock.h" @@ -1695,9 +1691,9 @@ ftp_getdata(ftpbuf_t *ftp) char eprtarg[INET6_ADDRSTRLEN + sizeof("|x||xxxxx|")]; char out[INET6_ADDRSTRLEN]; int eprtarg_len; - if (!inet_ntop(AF_INET6, &((struct sockaddr_in6*) sa)->sin6_addr, out, sizeof(out))) { - goto bail; - } + const char *r; + r = inet_ntop(AF_INET6, &((struct sockaddr_in6*) sa)->sin6_addr, out, sizeof(out)); + ZEND_ASSERT(r != NULL); eprtarg_len = snprintf(eprtarg, sizeof(eprtarg), "|2|%s|%hu|", out, ntohs(((struct sockaddr_in6 *) &addr)->sin6_port)); diff --git a/ext/snmp/snmp.c b/ext/snmp/snmp.c index a5968949e9aae..30c629217d940 100644 --- a/ext/snmp/snmp.c +++ b/ext/snmp/snmp.c @@ -51,10 +51,6 @@ #endif #include -#ifndef HAVE_INET_NTOP -#error inet_ntop unsupported on this platform -#endif - #ifndef __P #ifdef __GNUC__ #define __P(args) args diff --git a/ext/sockets/sockets.c b/ext/sockets/sockets.c index e1cd5a6c29ac8..511762d968ce9 100644 --- a/ext/sockets/sockets.c +++ b/ext/sockets/sockets.c @@ -218,10 +218,6 @@ zend_module_entry sockets_module_entry = { ZEND_GET_MODULE(sockets) #endif -#ifndef HAVE_INET_NTOP -#error inet_ntop unsupported on this platform -#endif - static bool php_open_listen_sock(php_socket *sock, int port, int backlog) /* {{{ */ { struct sockaddr_in la; diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c index 8b0068129a679..4c8a032e3f35e 100644 --- a/ext/standard/basic_functions.c +++ b/ext/standard/basic_functions.c @@ -102,10 +102,6 @@ typedef struct yy_buffer_state *YY_BUFFER_STATE; # define INADDR_NONE ((zend_ulong) -1) #endif -#ifndef HAVE_INET_NTOP -# error inet_ntop unsupported on this platform -#endif - #include "zend_globals.h" #include "php_globals.h" #include "SAPI.h" @@ -636,9 +632,7 @@ PHP_FUNCTION(long2ip) zend_ulong ip; zend_long sip; struct in_addr myaddr; -#ifdef HAVE_INET_PTON char str[40]; -#endif ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_LONG(sip) diff --git a/ext/standard/basic_functions.stub.php b/ext/standard/basic_functions.stub.php index 66b458897adb4..2b3088598e975 100755 --- a/ext/standard/basic_functions.stub.php +++ b/ext/standard/basic_functions.stub.php @@ -2207,10 +2207,8 @@ function closelog(): true {} function syslog(int $priority, string $message): true {} // TODO make return type void #endif -#ifdef HAVE_INET_NTOP /** @refcount 1 */ function inet_ntop(string $ip): string|false {} -#endif #ifdef HAVE_INET_PTON /** @refcount 1 */ diff --git a/ext/standard/basic_functions_arginfo.h b/ext/standard/basic_functions_arginfo.h index 39500b2b582dc..17ada7a485e37 100644 --- a/ext/standard/basic_functions_arginfo.h +++ b/ext/standard/basic_functions_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 487cee0751d47b18bf0a8fbdb050313783f1b369 */ + * Stub hash: ef14c8ce17c75ee21befd09477934f005eabb1ed */ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_set_time_limit, 0, 1, _IS_BOOL, 0) ZEND_ARG_TYPE_INFO(0, seconds, IS_LONG, 0) @@ -720,11 +720,7 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_syslog, 0, 2, IS_TRUE, 0) ZEND_END_ARG_INFO() #endif -#if defined(HAVE_INET_NTOP) -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_inet_ntop, 0, 1, MAY_BE_STRING|MAY_BE_FALSE) - ZEND_ARG_TYPE_INFO(0, ip, IS_STRING, 0) -ZEND_END_ARG_INFO() -#endif +#define arginfo_inet_ntop arginfo_gethostbyaddr #if defined(HAVE_INET_PTON) ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_inet_pton, 0, 1, MAY_BE_STRING|MAY_BE_FALSE) @@ -2415,9 +2411,7 @@ ZEND_FUNCTION(closelog); #if defined(HAVE_SYSLOG_H) ZEND_FUNCTION(syslog); #endif -#if defined(HAVE_INET_NTOP) ZEND_FUNCTION(inet_ntop); -#endif #if defined(HAVE_INET_PTON) ZEND_FUNCTION(inet_pton); #endif @@ -3050,9 +3044,7 @@ static const zend_function_entry ext_functions[] = { #if defined(HAVE_SYSLOG_H) ZEND_FE(syslog, arginfo_syslog) #endif -#if defined(HAVE_INET_NTOP) ZEND_FE(inet_ntop, arginfo_inet_ntop) -#endif #if defined(HAVE_INET_PTON) ZEND_FE(inet_pton, arginfo_inet_pton) #endif diff --git a/ext/standard/dns.c b/ext/standard/dns.c index 9c62288e95630..4d7826750ed44 100644 --- a/ext/standard/dns.c +++ b/ext/standard/dns.c @@ -57,10 +57,6 @@ extern void __res_ndestroy(res_state statp); #endif #endif -#ifndef HAVE_INET_NTOP -#error inet_ntop unsupported on this platform -#endif - #ifndef MAXHOSTNAMELEN #define MAXHOSTNAMELEN 255 #endif diff --git a/ext/standard/net.c b/ext/standard/net.c index beecf6c5ca727..80a6541bf60f9 100644 --- a/ext/standard/net.c +++ b/ext/standard/net.c @@ -47,10 +47,6 @@ # include #endif -#ifndef HAVE_INET_NTOP -#error inet_ntop unsupported on this platform -#endif - PHPAPI zend_string* php_inet_ntop(const struct sockaddr *addr) { socklen_t addrlen = sizeof(struct sockaddr_in); diff --git a/main/network.c b/main/network.c index cb2c098592858..2aca0002887dd 100644 --- a/main/network.c +++ b/main/network.c @@ -60,10 +60,6 @@ #endif #endif -#ifndef HAVE_INET_NTOP -#error inet_ntop unsupported on this platform -#endif - #ifndef HAVE_INET_ATON int inet_aton(const char *, struct in_addr *); #endif