From 9aa86518b4c0247a6f4b9e1f89265ccd2cd8eb11 Mon Sep 17 00:00:00 2001 From: Jorg Sowa Date: Thu, 15 Feb 2024 01:11:10 +0100 Subject: [PATCH 01/15] Remove HAVE_INET_PTON --- configure.ac | 5 +++++ ext/standard/basic_functions_arginfo.h | 4 +++- ext/standard/tests/network/ip2long_variation2_x64.phpt | 1 - 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index bdf5183d1c173..c2ed02591c589 100644 --- a/configure.ac +++ b/configure.ac @@ -635,6 +635,11 @@ mempcpy \ AC_CHECK_FUNC([inet_ntop],,[AC_MSG_ERROR([Required inet_ntop not found.])]) AC_CHECK_FUNC([inet_pton],,[AC_MSG_ERROR([Required inet_pton not found.])]) +AC_CHECK_FUNC(inet_pton,[],[ + AC_MSG_ERROR([Cannot find inet_pton 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/standard/basic_functions_arginfo.h b/ext/standard/basic_functions_arginfo.h index b08e1c2affb2e..7f6d270dc7ad4 100644 --- a/ext/standard/basic_functions_arginfo.h +++ b/ext/standard/basic_functions_arginfo.h @@ -2199,7 +2199,6 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_sapi_windows_generate_ctrl_event ZEND_END_ARG_INFO() #endif - ZEND_FRAMELESS_FUNCTION(min, 2); static const zend_frameless_function_info frameless_function_infos_min[] = { { ZEND_FRAMELESS_FUNCTION_NAME(min, 2), 2 }, @@ -2306,6 +2305,7 @@ static const zend_frameless_function_info frameless_function_infos_is_numeric[] { 0 }, }; + ZEND_FUNCTION(set_time_limit); ZEND_FUNCTION(header_register_callback); ZEND_FUNCTION(ob_start); @@ -3573,10 +3573,12 @@ static const zend_function_entry ext_functions[] = { ZEND_FE_END }; + static const zend_function_entry class___PHP_Incomplete_Class_methods[] = { ZEND_FE_END }; + static const zend_function_entry class_AssertionError_methods[] = { ZEND_FE_END }; diff --git a/ext/standard/tests/network/ip2long_variation2_x64.phpt b/ext/standard/tests/network/ip2long_variation2_x64.phpt index 95d45213f0201..7f446fa8e1bc0 100644 --- a/ext/standard/tests/network/ip2long_variation2_x64.phpt +++ b/ext/standard/tests/network/ip2long_variation2_x64.phpt @@ -7,7 +7,6 @@ Test ip2long() function : usage variation 2, 64 bit in the C language (i.e., a leading 0x or 0X implies hexadecimal; otherwise, a leading 0 implies octal; otherwise, the number is interpreted as decimal). */ -if(PHP_OS == 'Darwin') die("skip - inet_pton behaves differently on Darwin"); if(PHP_INT_SIZE != 8) {die('skip 64 bit only');} ?> --FILE-- From ecb09cf54e63f93f245e2cbca29377ed33a81fa1 Mon Sep 17 00:00:00 2001 From: Jorg Sowa Date: Thu, 15 Feb 2024 23:27:17 +0100 Subject: [PATCH 02/15] Generated stub --- ext/standard/basic_functions_arginfo.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ext/standard/basic_functions_arginfo.h b/ext/standard/basic_functions_arginfo.h index 7f6d270dc7ad4..4691c799b4668 100644 --- a/ext/standard/basic_functions_arginfo.h +++ b/ext/standard/basic_functions_arginfo.h @@ -722,7 +722,9 @@ ZEND_END_ARG_INFO() #define arginfo_inet_ntop arginfo_gethostbyaddr -#define arginfo_inet_pton arginfo_gethostbyaddr +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_inet_pton, 0, 1, MAY_BE_STRING|MAY_BE_FALSE) + ZEND_ARG_TYPE_INFO(0, ip, IS_STRING, 0) +ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_metaphone, 0, 1, IS_STRING, 0) ZEND_ARG_TYPE_INFO(0, string, IS_STRING, 0) @@ -2924,6 +2926,7 @@ ZEND_FUNCTION(sapi_windows_set_ctrl_handler); ZEND_FUNCTION(sapi_windows_generate_ctrl_event); #endif + static const zend_function_entry ext_functions[] = { ZEND_FE(set_time_limit, arginfo_set_time_limit) ZEND_FE(header_register_callback, arginfo_header_register_callback) From bb4e3e5418c43f5186120be946225846b56e207b Mon Sep 17 00:00:00 2001 From: Jorg Sowa Date: Fri, 16 Feb 2024 21:00:11 +0100 Subject: [PATCH 03/15] Reverted skip of test on Darwin --- ext/standard/tests/network/ip2long_variation2_x64.phpt | 1 + 1 file changed, 1 insertion(+) diff --git a/ext/standard/tests/network/ip2long_variation2_x64.phpt b/ext/standard/tests/network/ip2long_variation2_x64.phpt index 7f446fa8e1bc0..95d45213f0201 100644 --- a/ext/standard/tests/network/ip2long_variation2_x64.phpt +++ b/ext/standard/tests/network/ip2long_variation2_x64.phpt @@ -7,6 +7,7 @@ Test ip2long() function : usage variation 2, 64 bit in the C language (i.e., a leading 0x or 0X implies hexadecimal; otherwise, a leading 0 implies octal; otherwise, the number is interpreted as decimal). */ +if(PHP_OS == 'Darwin') die("skip - inet_pton behaves differently on Darwin"); if(PHP_INT_SIZE != 8) {die('skip 64 bit only');} ?> --FILE-- From 338de5edd6f6db254c24fdc04dcf40e68c60f682 Mon Sep 17 00:00:00 2001 From: Jorg Sowa Date: Fri, 16 Feb 2024 21:32:02 +0100 Subject: [PATCH 04/15] Generate stub --- ext/standard/basic_functions_arginfo.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/ext/standard/basic_functions_arginfo.h b/ext/standard/basic_functions_arginfo.h index 4691c799b4668..d8b5fcb0957f9 100644 --- a/ext/standard/basic_functions_arginfo.h +++ b/ext/standard/basic_functions_arginfo.h @@ -722,9 +722,7 @@ ZEND_END_ARG_INFO() #define arginfo_inet_ntop arginfo_gethostbyaddr -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_inet_pton, 0, 1, MAY_BE_STRING|MAY_BE_FALSE) - ZEND_ARG_TYPE_INFO(0, ip, IS_STRING, 0) -ZEND_END_ARG_INFO() +#define arginfo_inet_pton arginfo_gethostbyaddr ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_metaphone, 0, 1, IS_STRING, 0) ZEND_ARG_TYPE_INFO(0, string, IS_STRING, 0) From d0697cb04ea7ba0d5a2a4e25fda471752ac9eade Mon Sep 17 00:00:00 2001 From: Jorg Sowa Date: Sat, 17 Feb 2024 00:26:11 +0100 Subject: [PATCH 05/15] Inlined function checks --- configure.ac | 5 ----- 1 file changed, 5 deletions(-) diff --git a/configure.ac b/configure.ac index c2ed02591c589..bdf5183d1c173 100644 --- a/configure.ac +++ b/configure.ac @@ -635,11 +635,6 @@ mempcpy \ AC_CHECK_FUNC([inet_ntop],,[AC_MSG_ERROR([Required inet_ntop not found.])]) AC_CHECK_FUNC([inet_pton],,[AC_MSG_ERROR([Required inet_pton not found.])]) -AC_CHECK_FUNC(inet_pton,[],[ - AC_MSG_ERROR([Cannot find inet_pton which is required]) -] -) - dnl Check for strerror_r, and if its a POSIX-compatible or a GNU specific version. AC_FUNC_STRERROR_R From dcac5d098399c79d3fa85e02d21c0eddb9762507 Mon Sep 17 00:00:00 2001 From: Jorg Sowa Date: Sun, 18 Feb 2024 01:53:36 +0100 Subject: [PATCH 06/15] Removed inet_aton --- configure.ac | 4 +-- ext/standard/flock_compat.c | 66 ------------------------------------- ext/standard/flock_compat.h | 12 ------- main/network.c | 4 --- win32/inet.c | 27 --------------- win32/inet.h | 25 -------------- win32/sendmail.c | 1 - 7 files changed, 2 insertions(+), 137 deletions(-) delete mode 100644 win32/inet.c delete mode 100644 win32/inet.h diff --git a/configure.ac b/configure.ac index bdf5183d1c173..161eb63b09e39 100644 --- a/configure.ac +++ b/configure.ac @@ -375,8 +375,8 @@ case $host_alias in ;; esac -dnl Check for inet_aton in -lc and -lresolv. -PHP_CHECK_FUNC(inet_aton, resolv) +dnl Check for and -lresolv. +PHP_CHECK_FUNC(resolv) dnl Then headers. dnl ---------------------------------------------------------------------------- diff --git a/ext/standard/flock_compat.c b/ext/standard/flock_compat.c index 8622ec1aeca98..50ad961f00492 100644 --- a/ext/standard/flock_compat.c +++ b/ext/standard/flock_compat.c @@ -149,69 +149,3 @@ PHPAPI int php_flock(int fd, int operation) return 0; } #endif - -#ifndef PHP_WIN32 -#ifndef HAVE_INET_ATON -/* {{{ inet_aton - * Check whether "cp" is a valid ascii representation - * of an Internet address and convert to a binary address. - * Returns 1 if the address is valid, 0 if not. - * This replaces inet_addr, the return value from which - * cannot distinguish between failure and a local broadcast address. - */ -int inet_aton(const char *cp, struct in_addr *ap) -{ - int dots = 0; - unsigned long acc = 0, addr = 0; - - do { - char cc = *cp; - - switch (cc) { - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - acc = acc * 10 + (cc - '0'); - break; - - case '.': - if (++dots > 3) { - return 0; - } - /* Fall through */ - - case '\0': - if (acc > 255) { - return 0; - } - addr = addr << 8 | acc; - acc = 0; - break; - - default: - return 0; - } - } while (*cp++) ; - - /* Normalize the address */ - if (dots < 3) { - addr <<= 8 * (3 - dots) ; - } - - /* Store it if requested */ - if (ap) { - ap->s_addr = htonl(addr); - } - - return 1; -} -/* }}} */ -#endif /* !HAVE_INET_ATON */ -#endif diff --git a/ext/standard/flock_compat.h b/ext/standard/flock_compat.h index a55c3af9ca8f7..af0739bf15284 100644 --- a/ext/standard/flock_compat.h +++ b/ext/standard/flock_compat.h @@ -57,16 +57,4 @@ PHPAPI int flock(int fd, int operation); # define ftruncate(a, b) chsize(a, b) #endif /* defined(PHP_WIN32) */ -#ifndef HAVE_INET_ATON -# ifdef HAVE_NETINET_IN_H -# include -# endif -# ifdef HAVE_ARPA_INET_H -# include -# endif -# ifndef PHP_WIN32 -extern int inet_aton(const char *, struct in_addr *); -# endif -#endif - #endif /* FLOCK_COMPAT_H */ diff --git a/main/network.c b/main/network.c index a8de15936d108..fe811cb18582f 100644 --- a/main/network.c +++ b/main/network.c @@ -60,10 +60,6 @@ #endif #endif -#ifndef HAVE_INET_ATON -int inet_aton(const char *, struct in_addr *); -#endif - #include "php_network.h" #if defined(PHP_WIN32) || defined(__riscos__) diff --git a/win32/inet.c b/win32/inet.c deleted file mode 100644 index 3d5a847eb6eb1..0000000000000 --- a/win32/inet.c +++ /dev/null @@ -1,27 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | Copyright (c) The PHP Group | - +----------------------------------------------------------------------+ - | This source file is subject to version 3.01 of the PHP license, | - | that is bundled with this package in the file LICENSE, and is | - | available through the world-wide-web at the following url: | - | https://www.php.net/license/3_01.txt | - | If you did not receive a copy of the PHP license and are unable to | - | obtain it through the world-wide-web, please send a note to | - | license@php.net so we can mail you a copy immediately. | - +----------------------------------------------------------------------+ - | Author: Pierre Joye | - +----------------------------------------------------------------------+ - */ - -#include "inet.h" - -int inet_aton(const char *cp, struct in_addr *inp) { - inp->s_addr = inet_addr(cp); - - if (inp->s_addr == INADDR_NONE) { - return 0; - } - - return 1; -} diff --git a/win32/inet.h b/win32/inet.h deleted file mode 100644 index 6344051faa94a..0000000000000 --- a/win32/inet.h +++ /dev/null @@ -1,25 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | Copyright (c) The PHP Group | - +----------------------------------------------------------------------+ - | This source file is subject to version 3.01 of the PHP license, | - | that is bundled with this package in the file LICENSE, and is | - | available through the world-wide-web at the following url: | - | https://www.php.net/license/3_01.txt | - | If you did not receive a copy of the PHP license and are unable to | - | obtain it through the world-wide-web, please send a note to | - | license@php.net so we can mail you a copy immediately. | - +----------------------------------------------------------------------+ - | Author: Pierre Joye | - +----------------------------------------------------------------------+ - */ - -#ifndef PHP_WIN32_INET_H -#define PHP_WIN32_INET_H - -#include -#include - -PHPAPI int inet_aton(const char *cp, struct in_addr *inp); - -#endif diff --git a/win32/sendmail.c b/win32/sendmail.c index 6263eaac1a094..dcd350c02720b 100644 --- a/win32/sendmail.c +++ b/win32/sendmail.c @@ -29,7 +29,6 @@ #include #include "sendmail.h" #include "php_ini.h" -#include "inet.h" #include "php_win32_globals.h" From 31f87bbc8f4f48edd962f84a65d711472965d4fa Mon Sep 17 00:00:00 2001 From: Jorg Sowa Date: Sun, 18 Feb 2024 01:55:55 +0100 Subject: [PATCH 07/15] Removed leftover from comment --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 161eb63b09e39..b660ca6b69927 100644 --- a/configure.ac +++ b/configure.ac @@ -375,7 +375,7 @@ case $host_alias in ;; esac -dnl Check for and -lresolv. +dnl Check for -lresolv. PHP_CHECK_FUNC(resolv) dnl Then headers. From cc026bd0fa309ce0977094883ae0a593178d294c Mon Sep 17 00:00:00 2001 From: Jorg Sowa Date: Fri, 16 Feb 2024 23:12:41 +0100 Subject: [PATCH 08/15] Removed skipping on Darwin for socket test --- ext/sockets/tests/socket_set_option_error_socket_option.phpt | 3 --- 1 file changed, 3 deletions(-) diff --git a/ext/sockets/tests/socket_set_option_error_socket_option.phpt b/ext/sockets/tests/socket_set_option_error_socket_option.phpt index c8b5208f55672..37d263998fa6a 100644 --- a/ext/sockets/tests/socket_set_option_error_socket_option.phpt +++ b/ext/sockets/tests/socket_set_option_error_socket_option.phpt @@ -5,9 +5,6 @@ sockets --SKIPIF-- Date: Wed, 21 Feb 2024 17:39:15 +0100 Subject: [PATCH 09/15] Reverted test --- ext/sockets/tests/socket_set_option_error_socket_option.phpt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ext/sockets/tests/socket_set_option_error_socket_option.phpt b/ext/sockets/tests/socket_set_option_error_socket_option.phpt index 37d263998fa6a..c8b5208f55672 100644 --- a/ext/sockets/tests/socket_set_option_error_socket_option.phpt +++ b/ext/sockets/tests/socket_set_option_error_socket_option.phpt @@ -5,6 +5,9 @@ sockets --SKIPIF-- Date: Wed, 21 Feb 2024 17:39:59 +0100 Subject: [PATCH 10/15] Reverted test --- main/php_network.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/main/php_network.h b/main/php_network.h index 0f155211d8fc7..a31bc57b76aee 100644 --- a/main/php_network.h +++ b/main/php_network.h @@ -19,9 +19,7 @@ #include -#ifdef PHP_WIN32 -# include "win32/inet.h" -#else +#ifndef PHP_WIN32 # undef closesocket # define closesocket close # include From 41f1e1a5391a9ba38b68e5c4c5bc6dcd90cd8742 Mon Sep 17 00:00:00 2001 From: Jorg Sowa Date: Wed, 21 Feb 2024 22:55:43 +0100 Subject: [PATCH 11/15] Removed win32/inet.h includes --- ext/sockets/sockets.c | 1 - ext/standard/basic_functions.c | 2 -- ext/standard/dns.c | 1 - main/network.c | 1 - 4 files changed, 5 deletions(-) diff --git a/ext/sockets/sockets.c b/ext/sockets/sockets.c index d82a6f7cd702d..7413343433849 100644 --- a/ext/sockets/sockets.c +++ b/ext/sockets/sockets.c @@ -30,7 +30,6 @@ #include "php_ini.h" #ifdef PHP_WIN32 # include "windows_common.h" -# include # include # include # include "php_sockets.h" diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c index 87b4e7571c6af..9dddfdc782e27 100644 --- a/ext/standard/basic_functions.c +++ b/ext/standard/basic_functions.c @@ -68,8 +68,6 @@ typedef struct yy_buffer_state *YY_BUFFER_STATE; #ifndef PHP_WIN32 # include -#else -#include "win32/inet.h" #endif #ifdef HAVE_ARPA_INET_H diff --git a/ext/standard/dns.c b/ext/standard/dns.c index 5857351688da2..d56616837f68f 100644 --- a/ext/standard/dns.c +++ b/ext/standard/dns.c @@ -25,7 +25,6 @@ #endif #ifdef PHP_WIN32 -# include "win32/inet.h" # include # include # include diff --git a/main/network.c b/main/network.c index fe811cb18582f..8a2f1a56c6255 100644 --- a/main/network.c +++ b/main/network.c @@ -25,7 +25,6 @@ #ifdef PHP_WIN32 # include -# include "win32/inet.h" # include "win32/winutil.h" # define O_RDONLY _O_RDONLY # include "win32/param.h" From da49d84188aee261fd06b7bfd7c02d44ee7d483f Mon Sep 17 00:00:00 2001 From: Jorg Sowa Date: Thu, 22 Feb 2024 06:51:05 +0100 Subject: [PATCH 12/15] Removed import of win32\inet.c --- win32/build/config.w32 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/win32/build/config.w32 b/win32/build/config.w32 index ef11223c662b2..a1e9d92cbd0ca 100644 --- a/win32/build/config.w32 +++ b/win32/build/config.w32 @@ -307,7 +307,7 @@ if (VS_TOOLSET && VCVERS >= 1914) { ADD_SOURCES("win32", "dllmain.c glob.c readdir.c \ registry.c select.c sendmail.c time.c winutil.c wsyslog.c globals.c \ getrusage.c ftok.c ioutil.c codepage.c nice.c \ - inet.c fnmatch.c sockets.c console.c signal.c"); + fnmatch.c sockets.c console.c signal.c"); ADD_FLAG("CFLAGS_BD_WIN32", "/D ZEND_ENABLE_STATIC_TSRMLS_CACHE=1"); if (VS_TOOLSET && VCVERS >= 1914) { From 77c1c2c04a45372f379b9df0118b32abf5205155 Mon Sep 17 00:00:00 2001 From: Jorg Sowa Date: Thu, 22 Feb 2024 22:01:16 +0100 Subject: [PATCH 13/15] Update stub --- ext/standard/basic_functions_arginfo.h | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/ext/standard/basic_functions_arginfo.h b/ext/standard/basic_functions_arginfo.h index d8b5fcb0957f9..b08e1c2affb2e 100644 --- a/ext/standard/basic_functions_arginfo.h +++ b/ext/standard/basic_functions_arginfo.h @@ -2199,6 +2199,7 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_sapi_windows_generate_ctrl_event ZEND_END_ARG_INFO() #endif + ZEND_FRAMELESS_FUNCTION(min, 2); static const zend_frameless_function_info frameless_function_infos_min[] = { { ZEND_FRAMELESS_FUNCTION_NAME(min, 2), 2 }, @@ -2305,7 +2306,6 @@ static const zend_frameless_function_info frameless_function_infos_is_numeric[] { 0 }, }; - ZEND_FUNCTION(set_time_limit); ZEND_FUNCTION(header_register_callback); ZEND_FUNCTION(ob_start); @@ -2924,7 +2924,6 @@ ZEND_FUNCTION(sapi_windows_set_ctrl_handler); ZEND_FUNCTION(sapi_windows_generate_ctrl_event); #endif - static const zend_function_entry ext_functions[] = { ZEND_FE(set_time_limit, arginfo_set_time_limit) ZEND_FE(header_register_callback, arginfo_header_register_callback) @@ -3574,12 +3573,10 @@ static const zend_function_entry ext_functions[] = { ZEND_FE_END }; - static const zend_function_entry class___PHP_Incomplete_Class_methods[] = { ZEND_FE_END }; - static const zend_function_entry class_AssertionError_methods[] = { ZEND_FE_END }; From 12f6838762b75c2b915747b829d5aafa33633a62 Mon Sep 17 00:00:00 2001 From: Jorg Sowa Date: Thu, 22 Feb 2024 23:50:05 +0100 Subject: [PATCH 14/15] Removed resolv check --- configure.ac | 3 --- 1 file changed, 3 deletions(-) diff --git a/configure.ac b/configure.ac index b660ca6b69927..1ec8c8b36bd6f 100644 --- a/configure.ac +++ b/configure.ac @@ -375,9 +375,6 @@ case $host_alias in ;; esac -dnl Check for -lresolv. -PHP_CHECK_FUNC(resolv) - dnl Then headers. dnl ---------------------------------------------------------------------------- From 1ea65a819d491ea6d3f5420e885493808ade3a67 Mon Sep 17 00:00:00 2001 From: Jorg Sowa Date: Fri, 23 Feb 2024 22:06:58 +0100 Subject: [PATCH 15/15] [skip-ci] Added entry to UPGRADING.INTERNALS --- UPGRADING.INTERNALS | 1 + 1 file changed, 1 insertion(+) diff --git a/UPGRADING.INTERNALS b/UPGRADING.INTERNALS index 6e30418e06209..91c0e6438ea12 100644 --- a/UPGRADING.INTERNALS +++ b/UPGRADING.INTERNALS @@ -48,6 +48,7 @@ PHP 8.4 INTERNALS UPGRADE NOTES - The configure option --with-pspell has been removed. - Symbol SIZEOF_SHORT removed (size of 2 on 32-bit and 64-bit platforms). - Symbol DBA_CDB_MAKE removed in ext/dba. + - Symbol HAVE_INET_ATON and function inet_aton removed. b. Unix build system changes - The configure option --with-imap-ssl has been removed.