From b8f721a74e6abc67d8b5e4f85c34a67d82b3f853 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Wed, 4 Jan 2023 16:36:26 +0100 Subject: [PATCH 01/14] UPGRADING.INTERNALS: mention the header cleanups --- UPGRADING.INTERNALS | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/UPGRADING.INTERNALS b/UPGRADING.INTERNALS index d6911af58db1..770300a350c0 100644 --- a/UPGRADING.INTERNALS +++ b/UPGRADING.INTERNALS @@ -20,6 +20,12 @@ PHP 8.3 INTERNALS UPGRADE NOTES EG(stack_base). * EG(opline_before_exception) may now be null if the VM throws an exception before executing any opline. +* Many C header files have been cleaned up and include dependencies + have been reduced. Many headers which used to be always included by + Zend headers (e.g. "errno.h") are no longer implied, and this may + break the build of third-party extensions which relied on this + implementation detail. Those extensions may need to add the missing + #include lines. ======================== 2. Build system changes From 02855d3b0d507d560203a82613d6b3a2cd206d87 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Wed, 4 Jan 2023 14:59:41 +0100 Subject: [PATCH 02/14] Zend/zend_signal: include cleanup --- Zend/zend_signal.c | 9 ++++++--- Zend/zend_signal.h | 9 +++++++++ 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/Zend/zend_signal.c b/Zend/zend_signal.c index aa74bdd147c9..8fd55942f86f 100644 --- a/Zend/zend_signal.c +++ b/Zend/zend_signal.c @@ -28,11 +28,14 @@ #ifndef _GNU_SOURCE # define _GNU_SOURCE #endif -#include -#include "zend.h" -#include "zend_globals.h" +#include "zend_signal.h" +#include "zend_alloc.h" +#include "zend.h" // for zend_output_debug_string(), zend_error(), ... + +#include #include +#include #ifdef HAVE_UNISTD_H #include diff --git a/Zend/zend_signal.h b/Zend/zend_signal.h index 93edc1f0e021..53ef58fa53f9 100644 --- a/Zend/zend_signal.h +++ b/Zend/zend_signal.h @@ -21,9 +21,18 @@ #ifndef ZEND_SIGNAL_H #define ZEND_SIGNAL_H +#ifdef PHP_WIN32 +#include "config.w32.h" +#else +#include "php_config.h" // for ZEND_SIGNALS +#endif + #ifdef ZEND_SIGNALS +#include "zend_portability.h" // for BEGIN_EXTERN_C + #include +#include #ifndef NSIG #define NSIG 65 From 9748ad70c9eb86d19b89fad0476ff57ef5917290 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Wed, 4 Jan 2023 14:46:42 +0100 Subject: [PATCH 03/14] Zend/zend_ini: include cleanup --- Zend/zend_ini.c | 4 +++- Zend/zend_ini.h | 12 ++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/Zend/zend_ini.c b/Zend/zend_ini.c index 77fab940d664..e2979e76444c 100644 --- a/Zend/zend_ini.c +++ b/Zend/zend_ini.c @@ -16,16 +16,18 @@ +----------------------------------------------------------------------+ */ +#include "zend_ini.h" #include "zend.h" #include "zend_sort.h" #include "zend_API.h" -#include "zend_ini.h" #include "zend_alloc.h" #include "zend_operators.h" #include "zend_strtod.h" #include "zend_modules.h" #include "zend_smart_str.h" + #include +#include static HashTable *registered_zend_ini_directives; diff --git a/Zend/zend_ini.h b/Zend/zend_ini.h index 048d8a3cc389..ce5af258d870 100644 --- a/Zend/zend_ini.h +++ b/Zend/zend_ini.h @@ -19,12 +19,24 @@ #ifndef ZEND_INI_H #define ZEND_INI_H +#include "zend_portability.h" // for BEGIN_EXTERN_C +#include "zend_types.h" // for zend_result + +#include + #define ZEND_INI_USER (1<<0) #define ZEND_INI_PERDIR (1<<1) #define ZEND_INI_SYSTEM (1<<2) #define ZEND_INI_ALL (ZEND_INI_USER|ZEND_INI_PERDIR|ZEND_INI_SYSTEM) +// forward declarations +typedef struct _zend_file_handle zend_file_handle; +typedef struct _zend_ini_entry zend_ini_entry; +typedef struct _zend_module_entry zend_module_entry; +typedef struct _zend_string zend_string; +typedef struct _zend_array HashTable; + #define ZEND_INI_MH(name) int name(zend_ini_entry *entry, zend_string *new_value, void *mh_arg1, void *mh_arg2, void *mh_arg3, int stage) #define ZEND_INI_DISP(name) ZEND_COLD void name(zend_ini_entry *ini_entry, int type) From ed30b67dadfad69b621909b2a5317acac81ce684 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Wed, 4 Jan 2023 14:40:25 +0100 Subject: [PATCH 04/14] main/s[np]printf: include cleanup --- main/snprintf.c | 2 +- main/snprintf.h | 3 +++ main/spprintf.c | 3 ++- main/spprintf.h | 2 ++ 4 files changed, 8 insertions(+), 2 deletions(-) diff --git a/main/snprintf.c b/main/snprintf.c index 3c379c5c2ce1..d00fb83286e2 100644 --- a/main/snprintf.c +++ b/main/snprintf.c @@ -17,7 +17,7 @@ #ifndef _GNU_SOURCE # define _GNU_SOURCE #endif -#include "php.h" +#include "snprintf.h" #include diff --git a/main/snprintf.h b/main/snprintf.h index 2ff7116c3fbb..99c746d994ac 100644 --- a/main/snprintf.h +++ b/main/snprintf.h @@ -66,6 +66,9 @@ spprintf is the dynamical version of snprintf. It allocates the buffer in size #ifndef SNPRINTF_H #define SNPRINTF_H +#include "php.h" // for PHPAPI +#include "zend_portability.h" // for BEGIN_EXTERN_C + #include BEGIN_EXTERN_C() diff --git a/main/spprintf.c b/main/spprintf.c index 37b81dc6d530..f4faf0d894c5 100644 --- a/main/spprintf.c +++ b/main/spprintf.c @@ -75,7 +75,8 @@ #ifndef _GNU_SOURCE # define _GNU_SOURCE #endif -#include "php.h" +#include "spprintf.h" +#include "zend_strtod.h" #include #include diff --git a/main/spprintf.h b/main/spprintf.h index 4da224845b3b..73d9286d4743 100644 --- a/main/spprintf.h +++ b/main/spprintf.h @@ -18,6 +18,8 @@ #define SPPRINTF_H #include "snprintf.h" +#include "php.h" // for PHPAPI +#include "zend_portability.h" // for BEGIN_EXTERN_C #include "zend_smart_str_public.h" #include "zend_smart_string_public.h" From 3ff000c3328fa68f0a62c6d20679cdc298c859df Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Wed, 4 Jan 2023 10:05:17 +0100 Subject: [PATCH 05/14] Zend/zend_smart_str: include cleanup --- Zend/zend_smart_str.c | 4 +++- Zend/zend_smart_str.h | 9 +++++++-- Zend/zend_smart_str_public.h | 5 +++++ Zend/zend_smart_string.h | 5 +++-- Zend/zend_smart_string_public.h | 2 +- 5 files changed, 19 insertions(+), 6 deletions(-) diff --git a/Zend/zend_smart_str.c b/Zend/zend_smart_str.c index 5132043c60e2..689989059c2d 100644 --- a/Zend/zend_smart_str.c +++ b/Zend/zend_smart_str.c @@ -14,9 +14,11 @@ +----------------------------------------------------------------------+ */ -#include #include "zend_smart_str.h" #include "zend_smart_string.h" +#include "zend_globals_macros.h" // for EG() +#include "zend_globals.h" // struct _zend_executor_globals +#include "zend_strtod.h" // for zend_gcvt() #define SMART_STR_OVERHEAD (ZEND_MM_OVERHEAD + _ZSTR_HEADER_SIZE + 1) #define SMART_STR_START_SIZE 256 diff --git a/Zend/zend_smart_str.h b/Zend/zend_smart_str.h index e271835e41db..ac5b18db97e2 100644 --- a/Zend/zend_smart_str.h +++ b/Zend/zend_smart_str.h @@ -17,10 +17,15 @@ #ifndef ZEND_SMART_STR_H #define ZEND_SMART_STR_H -#include -#include "zend_globals.h" #include "zend_smart_str_public.h" +#include "zend_operators.h" // for zend_print_long_to_buf() +#include "zend_portability.h" // for BEGIN_EXTERN_C +#include "zend_string.h" + +// forward declarations +typedef struct _zval_struct zval; + BEGIN_EXTERN_C() ZEND_API void ZEND_FASTCALL smart_str_erealloc(smart_str *str, size_t len); diff --git a/Zend/zend_smart_str_public.h b/Zend/zend_smart_str_public.h index e81a6839b3bb..84fc3758ae7c 100644 --- a/Zend/zend_smart_str_public.h +++ b/Zend/zend_smart_str_public.h @@ -17,6 +17,11 @@ #ifndef ZEND_SMART_STR_PUBLIC_H #define ZEND_SMART_STR_PUBLIC_H +#include // for size_t + +// forward declarations +typedef struct _zend_string zend_string; + typedef struct { /** See smart_str_extract() */ zend_string *s; diff --git a/Zend/zend_smart_string.h b/Zend/zend_smart_string.h index 8149b29fb333..08eb6a8eced7 100644 --- a/Zend/zend_smart_string.h +++ b/Zend/zend_smart_string.h @@ -20,8 +20,9 @@ #include "zend_smart_string_public.h" -#include -#include +#include "zend_alloc.h" // for pefree() +#include "zend_operators.h" // for zend_print_long_to_buf() +#include "zend_portability.h" // for ZEND_FASTCALL /* wrapper */ diff --git a/Zend/zend_smart_string_public.h b/Zend/zend_smart_string_public.h index 543e1d37a4ef..e61bdd2d36f4 100644 --- a/Zend/zend_smart_string_public.h +++ b/Zend/zend_smart_string_public.h @@ -18,7 +18,7 @@ #ifndef PHP_SMART_STRING_PUBLIC_H #define PHP_SMART_STRING_PUBLIC_H -#include +#include // for size_t typedef struct { char *c; From ff2561908a830e0faa20e4ca570586c8bd2a6e80 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Wed, 4 Jan 2023 15:03:56 +0100 Subject: [PATCH 06/14] main: add missing includes --- main/main.c | 2 ++ main/streams/plain_wrapper.c | 3 +++ main/streams/streams.c | 3 +++ main/streams/xp_socket.c | 3 +++ 4 files changed, 11 insertions(+) diff --git a/main/main.c b/main/main.c index 2605e554c7ce..17da657d1772 100644 --- a/main/main.c +++ b/main/main.c @@ -82,6 +82,8 @@ #include "rfc1867.h" #include "ext/standard/html_tables.h" + +#include // for DBL_*, used by main_arginfo.h #include "main_arginfo.h" /* }}} */ diff --git a/main/streams/plain_wrapper.c b/main/streams/plain_wrapper.c index e9a30f333401..a7013a6f8fb1 100644 --- a/main/streams/plain_wrapper.c +++ b/main/streams/plain_wrapper.c @@ -42,6 +42,9 @@ # include "win32/readdir.h" #endif +#include +#include // for strerror() + #define php_stream_fopen_from_fd_int(fd, mode, persistent_id) _php_stream_fopen_from_fd_int((fd), (mode), (persistent_id) STREAMS_CC) #define php_stream_fopen_from_fd_int_rel(fd, mode, persistent_id) _php_stream_fopen_from_fd_int((fd), (mode), (persistent_id) STREAMS_REL_CC) #define php_stream_fopen_from_file_int(file, mode) _php_stream_fopen_from_file_int((file), (mode) STREAMS_CC) diff --git a/main/streams/streams.c b/main/streams/streams.c index 1231dbebd63a..fc167a28728b 100644 --- a/main/streams/streams.c +++ b/main/streams/streams.c @@ -32,6 +32,9 @@ #include #include "php_streams_int.h" +#include +#include // for strerror() + /* {{{ resource and registration code */ /* Global wrapper hash, copied to FG(stream_wrappers) on registration of volatile wrapper */ static HashTable url_stream_wrappers_hash; diff --git a/main/streams/xp_socket.c b/main/streams/xp_socket.c index 3a4beca9f077..aa10f598d628 100644 --- a/main/streams/xp_socket.c +++ b/main/streams/xp_socket.c @@ -25,8 +25,11 @@ #ifdef AF_UNIX #include +#include // for strerror() #endif +#include + #ifndef MSG_DONTWAIT # define MSG_DONTWAIT 0 #endif From 6caac6bb02f8b359b498ed8c2e1231460c8486bd Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Wed, 4 Jan 2023 10:54:26 +0100 Subject: [PATCH 07/14] ext/{standard,json,random,...}: add missing includes --- ext/intl/collator/collator_is_numeric.c | 3 +++ ext/json/json_encoder.c | 1 + ext/json/json_scanner.re | 1 + ext/mbstring/libmbfl/filters/mbfilter_base64.c | 1 + ext/mysqlnd/mysql_float_to_double.h | 1 + ext/mysqlnd/mysqlnd_connection.c | 2 ++ ext/mysqlnd/mysqlnd_wireprotocol.c | 1 + ext/oci8/oci8_collection.c | 1 + ext/opcache/jit/zend_jit.c | 4 ++++ ext/opcache/zend_file_cache.c | 1 + ext/openssl/xp_ssl.c | 2 ++ ext/pcre/php_pcre.c | 1 + ext/pdo_pgsql/pgsql_driver.c | 2 ++ ext/pgsql/pgsql.c | 1 + ext/phar/phar_object.c | 2 ++ ext/random/gammasection.c | 2 ++ ext/random/random.c | 1 + ext/random/randomizer.c | 2 ++ ext/shmop/shmop.c | 4 +++- ext/soap/php_encoding.c | 2 ++ ext/sockets/conversions.c | 1 + ext/sockets/multicast.c | 1 + ext/sockets/sendrecvmsg.c | 2 ++ ext/sockets/sockaddr_conv.c | 1 + ext/spl/spl_directory.c | 3 +++ ext/standard/array.c | 1 + ext/standard/basic_functions.c | 4 ++++ ext/standard/dns.c | 3 +++ ext/standard/exec.c | 4 ++++ ext/standard/formatted_print.c | 1 + ext/standard/ftok.c | 4 ++++ ext/standard/hrtime.c | 1 + ext/standard/mail.c | 2 ++ ext/standard/math.c | 1 + ext/standard/net.c | 3 +++ ext/standard/php_fopen_wrapper.c | 3 +++ ext/standard/proc_open.c | 3 +++ ext/standard/streamsfuncs.c | 3 +++ ext/standard/var.c | 1 + ext/standard/var_unserializer.re | 1 + ext/sysvmsg/sysvmsg.c | 5 ++++- 41 files changed, 81 insertions(+), 2 deletions(-) diff --git a/ext/intl/collator/collator_is_numeric.c b/ext/intl/collator/collator_is_numeric.c index 823fb4088d8f..0f6c216502da 100644 --- a/ext/intl/collator/collator_is_numeric.c +++ b/ext/intl/collator/collator_is_numeric.c @@ -14,6 +14,9 @@ */ #include "collator_is_numeric.h" +#include "zend_strtod.h" + +#include /* {{{ Taken from PHP6:zend_u_strtod() */ static double collator_u_strtod(const UChar *nptr, UChar **endptr) /* {{{ */ diff --git a/ext/json/json_encoder.c b/ext/json/json_encoder.c index adb53598326b..a3e136ec9b5e 100644 --- a/ext/json/json_encoder.c +++ b/ext/json/json_encoder.c @@ -28,6 +28,7 @@ #include "php_json_encoder.h" #include #include "zend_enum.h" +#include "zend_strtod.h" // for ZEND_DOUBLE_MAX_LENGTH static const char digits[] = "0123456789abcdef"; diff --git a/ext/json/json_scanner.re b/ext/json/json_scanner.re index 1db43dd081a5..014f29bd5641 100644 --- a/ext/json/json_scanner.re +++ b/ext/json/json_scanner.re @@ -18,6 +18,7 @@ #include "php_json_scanner.h" #include "php_json_scanner_defs.h" #include "php_json_parser.h" +#include "zend_strtod.h" #include "json_parser.tab.h" #define YYCTYPE php_json_ctype diff --git a/ext/mbstring/libmbfl/filters/mbfilter_base64.c b/ext/mbstring/libmbfl/filters/mbfilter_base64.c index ede3eef18ce7..bc06c6a1abf1 100644 --- a/ext/mbstring/libmbfl/filters/mbfilter_base64.c +++ b/ext/mbstring/libmbfl/filters/mbfilter_base64.c @@ -30,6 +30,7 @@ #include "mbfilter.h" #include "mbfilter_base64.h" +#include "zend_multiply.h" // for zend_safe_address_guarded() static size_t mb_base64_to_wchar(unsigned char **in, size_t *in_len, uint32_t *buf, size_t bufsize, unsigned int *state); static void mb_wchar_to_base64(uint32_t *in, size_t len, mb_convert_buf *buf, bool end); diff --git a/ext/mysqlnd/mysql_float_to_double.h b/ext/mysqlnd/mysql_float_to_double.h index a15458b52de2..b868aa67aa4c 100644 --- a/ext/mysqlnd/mysql_float_to_double.h +++ b/ext/mysqlnd/mysql_float_to_double.h @@ -20,6 +20,7 @@ #include "main/php.h" #include #include "main/snprintf.h" +#include "zend_strtod.h" #define MAX_CHAR_BUF_LEN 255 diff --git a/ext/mysqlnd/mysqlnd_connection.c b/ext/mysqlnd/mysqlnd_connection.c index ed4d1af277dd..666ab6662158 100644 --- a/ext/mysqlnd/mysqlnd_connection.c +++ b/ext/mysqlnd/mysqlnd_connection.c @@ -30,6 +30,8 @@ #include "mysqlnd_ext_plugin.h" #include "zend_smart_str.h" +#include +#include // for strerror() extern MYSQLND_CHARSET *mysqlnd_charsets; diff --git a/ext/mysqlnd/mysqlnd_wireprotocol.c b/ext/mysqlnd/mysqlnd_wireprotocol.c index fce042ec5be5..25f178e0b57d 100644 --- a/ext/mysqlnd/mysqlnd_wireprotocol.c +++ b/ext/mysqlnd/mysqlnd_wireprotocol.c @@ -23,6 +23,7 @@ #include "mysqlnd_wireprotocol.h" #include "mysqlnd_statistics.h" #include "mysqlnd_debug.h" +#include "zend_strtod.h" #define BAIL_IF_NO_MORE_DATA \ if (UNEXPECTED((size_t)(p - begin) > packet->header.size)) { \ diff --git a/ext/oci8/oci8_collection.c b/ext/oci8/oci8_collection.c index dcad33564751..b3529354b8a7 100644 --- a/ext/oci8/oci8_collection.c +++ b/ext/oci8/oci8_collection.c @@ -35,6 +35,7 @@ #include "php_oci8.h" #include "php_oci8_int.h" +#include "zend_strtod.h" /* {{{ php_oci_collection_create() Create and return connection handle */ diff --git a/ext/opcache/jit/zend_jit.c b/ext/opcache/jit/zend_jit.c index 429d8dbd49f5..b7af6f83d31a 100644 --- a/ext/opcache/jit/zend_jit.c +++ b/ext/opcache/jit/zend_jit.c @@ -51,6 +51,10 @@ #include #endif +#ifdef HAVE_MPROTECT +#include +#endif + #ifdef ZTS int jit_globals_id; #else diff --git a/ext/opcache/zend_file_cache.c b/ext/opcache/zend_file_cache.c index 1cd639403f68..f98bd66fa04a 100644 --- a/ext/opcache/zend_file_cache.c +++ b/ext/opcache/zend_file_cache.c @@ -42,6 +42,7 @@ #include #include +#include #include #if HAVE_UNISTD_H diff --git a/ext/openssl/xp_ssl.c b/ext/openssl/xp_ssl.c index 048076808925..d245fab5a78f 100644 --- a/ext/openssl/xp_ssl.c +++ b/ext/openssl/xp_ssl.c @@ -36,6 +36,8 @@ #include #include +#include + #ifdef PHP_WIN32 #include "win32/winutil.h" #include "win32/time.h" diff --git a/ext/pcre/php_pcre.c b/ext/pcre/php_pcre.c index f4fd60e96ebe..099e1e5bbbc4 100644 --- a/ext/pcre/php_pcre.c +++ b/ext/pcre/php_pcre.c @@ -20,6 +20,7 @@ #include "php_pcre.h" #include "ext/standard/info.h" #include "ext/standard/basic_functions.h" +#include "zend_multiply.h" // for zend_safe_address_guarded() #include "zend_smart_str.h" #include "SAPI.h" diff --git a/ext/pdo_pgsql/pgsql_driver.c b/ext/pdo_pgsql/pgsql_driver.c index ec4d5ec65866..cdd9b6ddae32 100644 --- a/ext/pdo_pgsql/pgsql_driver.c +++ b/ext/pdo_pgsql/pgsql_driver.c @@ -34,6 +34,8 @@ #include "zend_exceptions.h" #include "pgsql_driver_arginfo.h" +#include + static bool pgsql_handle_in_transaction(pdo_dbh_t *dbh); static char * _pdo_pgsql_trim_message(const char *message, int persistent) diff --git a/ext/pgsql/pgsql.c b/ext/pgsql/pgsql.c index 00bdf15286e0..0679b2b6c463 100644 --- a/ext/pgsql/pgsql.c +++ b/ext/pgsql/pgsql.c @@ -39,6 +39,7 @@ #include "php_pgsql.h" #include "php_globals.h" #include "zend_exceptions.h" +#include "zend_strtod.h" #ifdef HAVE_PGSQL diff --git a/ext/phar/phar_object.c b/ext/phar/phar_object.c index 41c55b75898a..27e9ad204b91 100644 --- a/ext/phar/phar_object.c +++ b/ext/phar/phar_object.c @@ -21,6 +21,8 @@ #include "func_interceptors.h" #include "phar_object_arginfo.h" +#include + static zend_class_entry *phar_ce_archive; static zend_class_entry *phar_ce_data; static zend_class_entry *phar_ce_PharException; diff --git a/ext/random/gammasection.c b/ext/random/gammasection.c index fb0c2cd3bf94..2d97cfdcd9bf 100644 --- a/ext/random/gammasection.c +++ b/ext/random/gammasection.c @@ -24,6 +24,8 @@ #include "php_random.h" #include +#include // for DBL_MAX + /* This file implements the γ-section algorithm as published in: * * Drawing Random Floating-Point Numbers from an Interval. Frédéric diff --git a/ext/random/random.c b/ext/random/random.c index 4177bfc885f3..a66f18c7a5ce 100644 --- a/ext/random/random.c +++ b/ext/random/random.c @@ -41,6 +41,7 @@ # include #else # include +# include #endif #ifdef __linux__ diff --git a/ext/random/randomizer.c b/ext/random/randomizer.c index 0a801e35c74c..cb4ebd1a0732 100644 --- a/ext/random/randomizer.c +++ b/ext/random/randomizer.c @@ -27,6 +27,8 @@ #include "Zend/zend_enum.h" #include "Zend/zend_exceptions.h" +#include // for DBL_MANT_DIG + static inline void randomizer_common_init(php_random_randomizer *randomizer, zend_object *engine_object) { if (engine_object->ce->type == ZEND_INTERNAL_CLASS) { /* Internal classes always php_random_engine struct */ diff --git a/ext/shmop/shmop.c b/ext/shmop/shmop.c index be4f57ad2716..dfb301788dd0 100644 --- a/ext/shmop/shmop.c +++ b/ext/shmop/shmop.c @@ -33,11 +33,13 @@ #include "tsrm_win32.h" #endif - #ifdef HAVE_SHMOP #include "ext/standard/info.h" +#include +#include // for strerror() + /* {{{ shmop_module_entry */ zend_module_entry shmop_module_entry = { STANDARD_MODULE_HEADER, diff --git a/ext/soap/php_encoding.c b/ext/soap/php_encoding.c index 3b7d6c3885dc..6fc81d30686f 100644 --- a/ext/soap/php_encoding.c +++ b/ext/soap/php_encoding.c @@ -25,6 +25,8 @@ #include "zend_strtod.h" #include "zend_interfaces.h" +#include + /* zval type decode */ static zval *to_zval_double(zval* ret, encodeTypePtr type, xmlNodePtr data); static zval *to_zval_long(zval* ret, encodeTypePtr type, xmlNodePtr data); diff --git a/ext/sockets/conversions.c b/ext/sockets/conversions.c index ae90cbe59d2a..bb314b4bb4dc 100644 --- a/ext/sockets/conversions.c +++ b/ext/sockets/conversions.c @@ -24,6 +24,7 @@ # include #endif +#include #include #include #include diff --git a/ext/sockets/multicast.c b/ext/sockets/multicast.c index ef32661be09f..00e7b8f0488c 100644 --- a/ext/sockets/multicast.c +++ b/ext/sockets/multicast.c @@ -39,6 +39,7 @@ #include "sockaddr_conv.h" #include "main/php_network.h" +#include enum source_op { JOIN_SOURCE, diff --git a/ext/sockets/sendrecvmsg.c b/ext/sockets/sendrecvmsg.c index 5623b556aa00..eac78bda4137 100644 --- a/ext/sockets/sendrecvmsg.c +++ b/ext/sockets/sendrecvmsg.c @@ -28,6 +28,8 @@ #include #endif +#include + #define MAX_USER_BUFF_SIZE ((size_t)(100*1024*1024)) #define DEFAULT_BUFF_SIZE 8192 #define MAX_ARRAY_KEY_SIZE 128 diff --git a/ext/sockets/sockaddr_conv.c b/ext/sockets/sockaddr_conv.c index 6ec540931f72..2e8686bf5aba 100644 --- a/ext/sockets/sockaddr_conv.c +++ b/ext/sockets/sockaddr_conv.c @@ -5,6 +5,7 @@ #ifdef PHP_WIN32 #include "windows_common.h" #else +#include #include #include #endif diff --git a/ext/spl/spl_directory.c b/ext/spl/spl_directory.c index 5c32e2f9ee35..fc806b457a19 100644 --- a/ext/spl/spl_directory.c +++ b/ext/spl/spl_directory.c @@ -36,6 +36,9 @@ #include "spl_directory_arginfo.h" #include "spl_exceptions.h" +#include +#include // for strerror() + #define SPL_HAS_FLAG(flags, test_flag) ((flags & test_flag) ? 1 : 0) /* declare the class handlers */ diff --git a/ext/standard/array.c b/ext/standard/array.c index 6252b61d2042..96a32da8e055 100644 --- a/ext/standard/array.c +++ b/ext/standard/array.c @@ -40,6 +40,7 @@ #include "zend_smart_str.h" #include "zend_bitset.h" #include "zend_exceptions.h" +#include "zend_strtod.h" #include "ext/spl/spl_array.h" #include "ext/random/php_random.h" diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c index f65a71a7266d..4e10cac38c71 100644 --- a/ext/standard/basic_functions.c +++ b/ext/standard/basic_functions.c @@ -117,6 +117,10 @@ PHPAPI php_basic_globals basic_globals; #include "streamsfuncs.h" #include "basic_functions_arginfo.h" +#if defined(HAVE_NANOSLEEP) || !defined(PHP_WIN32) +#include +#endif + typedef struct _user_tick_function_entry { zend_fcall_info fci; zend_fcall_info_cache fci_cache; diff --git a/ext/standard/dns.c b/ext/standard/dns.c index d229b998a4b6..a5a5d86483e0 100644 --- a/ext/standard/dns.c +++ b/ext/standard/dns.c @@ -57,6 +57,9 @@ extern void __res_ndestroy(res_state statp); #endif #endif +#include +#include // for strerror() + #ifndef MAXHOSTNAMELEN #define MAXHOSTNAMELEN 255 #endif diff --git a/ext/standard/exec.c b/ext/standard/exec.c index 1b1b0ab9e9ce..108c7d282f88 100644 --- a/ext/standard/exec.c +++ b/ext/standard/exec.c @@ -46,6 +46,10 @@ #include #endif +#ifdef HAVE_NICE +#include +#endif + #include #ifdef PHP_WIN32 diff --git a/ext/standard/formatted_print.c b/ext/standard/formatted_print.c index b988422df21c..a98d410a228f 100644 --- a/ext/standard/formatted_print.c +++ b/ext/standard/formatted_print.c @@ -19,6 +19,7 @@ #include "ext/standard/head.h" #include "php_string.h" #include "zend_execute.h" +#include "zend_strtod.h" // for zend_gcvt() #include #include diff --git a/ext/standard/ftok.c b/ext/standard/ftok.c index 1a046b3de697..d00dd6d75e5b 100644 --- a/ext/standard/ftok.c +++ b/ext/standard/ftok.c @@ -27,6 +27,10 @@ #endif #ifdef HAVE_FTOK + +#include +#include // for strerror() + /* {{{ Convert a pathname and a project identifier to a System V IPC key */ PHP_FUNCTION(ftok) { diff --git a/ext/standard/hrtime.c b/ext/standard/hrtime.c index 7dca135c920a..5fe4f950f31e 100644 --- a/ext/standard/hrtime.c +++ b/ext/standard/hrtime.c @@ -17,6 +17,7 @@ #include "php.h" #include "hrtime.h" +#include "zend_strtod.h" /* {{{ */ /* This file reuses code parts from the cross-platform timer library diff --git a/ext/standard/mail.c b/ext/standard/mail.c index 55790e6100fc..b5e7efe8e45a 100644 --- a/ext/standard/mail.c +++ b/ext/standard/mail.c @@ -44,6 +44,8 @@ #ifdef PHP_WIN32 # include "win32/sendmail.h" +#else +# include #endif #define SKIP_LONG_HEADER_SEP(str, pos) \ diff --git a/ext/standard/math.c b/ext/standard/math.c index ad2823ea49bf..5b2d74a2de9e 100644 --- a/ext/standard/math.c +++ b/ext/standard/math.c @@ -23,6 +23,7 @@ #include "zend_exceptions.h" #include "zend_portability.h" #include "zend_bitset.h" +#include "zend_strtod.h" #include #include diff --git a/ext/standard/net.c b/ext/standard/net.c index b22f304c8eb3..83d3e2170420 100644 --- a/ext/standard/net.c +++ b/ext/standard/net.c @@ -47,6 +47,9 @@ # include #endif +#include +#include // for strerror() + PHPAPI zend_string* php_inet_ntop(const struct sockaddr *addr) { socklen_t addrlen = sizeof(struct sockaddr_in); diff --git a/ext/standard/php_fopen_wrapper.c b/ext/standard/php_fopen_wrapper.c index 8926485025a3..8f70ba2094cc 100644 --- a/ext/standard/php_fopen_wrapper.c +++ b/ext/standard/php_fopen_wrapper.c @@ -29,6 +29,9 @@ #include "php_fopen_wrappers.h" #include "SAPI.h" +#include +#include // for strerror() + static ssize_t php_stream_output_write(php_stream *stream, const char *buf, size_t count) /* {{{ */ { PHPWRITE(buf, count); diff --git a/ext/standard/proc_open.c b/ext/standard/proc_open.c index 53ec6faa1019..4281be769da2 100644 --- a/ext/standard/proc_open.c +++ b/ext/standard/proc_open.c @@ -36,6 +36,9 @@ #include #endif +#include +#include // for strerror() + /* This symbol is defined in ext/standard/config.m4. * Essentially, it is set if you HAVE_FORK || PHP_WIN32 * Other platforms may modify that configure check and add suitable #ifdefs diff --git a/ext/standard/streamsfuncs.c b/ext/standard/streamsfuncs.c index ac2c777eea52..5af3ec3d638d 100644 --- a/ext/standard/streamsfuncs.c +++ b/ext/standard/streamsfuncs.c @@ -40,6 +40,9 @@ typedef unsigned long long php_timeout_ull; typedef unsigned __int64 php_timeout_ull; #endif +#include +#include // for strerror() + #define GET_CTX_OPT(stream, wrapper, name, val) (PHP_STREAM_CONTEXT(stream) && NULL != (val = php_stream_context_get_option(PHP_STREAM_CONTEXT(stream), wrapper, name))) static php_stream_context *decode_context_param(zval *contextresource); diff --git a/ext/standard/var.c b/ext/standard/var.c index 7c6f79aba75f..707474509981 100644 --- a/ext/standard/var.c +++ b/ext/standard/var.c @@ -28,6 +28,7 @@ #include "php_incomplete_class.h" #include "zend_enum.h" #include "zend_exceptions.h" +#include "zend_strtod.h" // for zend_gcvt() /* }}} */ struct php_serialize_data { diff --git a/ext/standard/var_unserializer.re b/ext/standard/var_unserializer.re index 12b0ff47c803..fee8f9a73bf6 100644 --- a/ext/standard/var_unserializer.re +++ b/ext/standard/var_unserializer.re @@ -19,6 +19,7 @@ #include "php_incomplete_class.h" #include "zend_portability.h" #include "zend_exceptions.h" +#include "zend_strtod.h" /* {{{ reference-handling for unserializer: var_* */ #define VAR_ENTRIES_MAX 1018 /* 1024 - offsetof(php_unserialize_data, entries) / sizeof(void*) */ diff --git a/ext/sysvmsg/sysvmsg.c b/ext/sysvmsg/sysvmsg.c index debb8b675b0c..caaa5eccef35 100644 --- a/ext/sysvmsg/sysvmsg.c +++ b/ext/sysvmsg/sysvmsg.c @@ -22,10 +22,13 @@ #include "php_globals.h" #include "ext/standard/info.h" #include "php_sysvmsg.h" -#include "sysvmsg_arginfo.h" #include "ext/standard/php_var.h" #include "zend_smart_str.h" +#include +#include "sysvmsg_arginfo.h" + +#include // for strerror() #include #include #include From 943c24f8acdac7b02ccb73a2d482900406c35c81 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Wed, 4 Jan 2023 15:23:13 +0100 Subject: [PATCH 08/14] Zend/zend_fibers: include cleanup --- Zend/zend_fibers.c | 5 +++++ Zend/zend_fibers.h | 8 ++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/Zend/zend_fibers.c b/Zend/zend_fibers.c index f6065561793d..57d080d4dd13 100644 --- a/Zend/zend_fibers.c +++ b/Zend/zend_fibers.c @@ -17,6 +17,8 @@ +----------------------------------------------------------------------+ */ +#include "zend_fibers.h" +#include "zend_objects.h" // for zend_object_std_init() #include "zend.h" #include "zend_API.h" #include "zend_ini.h" @@ -42,6 +44,9 @@ # include # include +# include +# include // for strerror() + # if !defined(MAP_ANONYMOUS) && defined(MAP_ANON) # define MAP_ANONYMOUS MAP_ANON # endif diff --git a/Zend/zend_fibers.h b/Zend/zend_fibers.h index 5faa788f4ef6..15f7d43979d9 100644 --- a/Zend/zend_fibers.h +++ b/Zend/zend_fibers.h @@ -20,14 +20,18 @@ #ifndef ZEND_FIBERS_H #define ZEND_FIBERS_H -#include "zend_API.h" -#include "zend_types.h" +#include "zend_API.h" // for struct zend_fcall_info +#include "zend_portability.h" // for BEGIN_EXTERN_C + +#include #define ZEND_FIBER_GUARD_PAGES 1 #define ZEND_FIBER_DEFAULT_C_STACK_SIZE (4096 * (((sizeof(void *)) < 8) ? 256 : 512)) #define ZEND_FIBER_VM_STACK_SIZE (1024 * sizeof(zval)) +typedef struct _zend_fiber_context zend_fiber_context; + BEGIN_EXTERN_C() typedef enum { From 16047b01d9af40aceb11fb43ea99506ea12fb048 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Wed, 4 Jan 2023 16:12:50 +0100 Subject: [PATCH 09/14] sapi/*: add missing includes --- sapi/cgi/cgi_main.c | 2 ++ sapi/cli/php_cli.c | 2 ++ sapi/cli/php_cli_server.c | 3 +++ sapi/fpm/fpm/fpm_main.c | 3 +++ sapi/phpdbg/phpdbg_io.c | 2 ++ 5 files changed, 12 insertions(+) diff --git a/sapi/cgi/cgi_main.c b/sapi/cgi/cgi_main.c index b45468031fcd..f4f37537e722 100644 --- a/sapi/cgi/cgi_main.c +++ b/sapi/cgi/cgi_main.c @@ -95,6 +95,8 @@ int __riscosify_control = __RISCOSIFY_STRICT_UNIX_SPECS; # include "valgrind/callgrind.h" #endif +#include + #ifndef PHP_WIN32 /* XXX this will need to change later when threaded fastcgi is implemented. shane */ struct sigaction act, old_term, old_quit, old_int; diff --git a/sapi/cli/php_cli.c b/sapi/cli/php_cli.c index cc9a26c41389..c2c91574d578 100644 --- a/sapi/cli/php_cli.c +++ b/sapi/cli/php_cli.c @@ -92,6 +92,8 @@ # include "openssl/applink.c" #endif +#include + PHPAPI extern char *php_ini_opened_path; PHPAPI extern char *php_ini_scanned_path; PHPAPI extern char *php_ini_scanned_files; diff --git a/sapi/cli/php_cli_server.c b/sapi/cli/php_cli_server.c index 901281ddfdfc..5bc1cd4683ff 100644 --- a/sapi/cli/php_cli_server.c +++ b/sapi/cli/php_cli_server.c @@ -106,6 +106,9 @@ #include "php_cli_process_title.h" #include "php_cli_process_title_arginfo.h" +#include +#include // for strerror() + #define OUTPUT_NOT_CHECKED -1 #define OUTPUT_IS_TTY 1 #define OUTPUT_NOT_TTY 0 diff --git a/sapi/fpm/fpm/fpm_main.c b/sapi/fpm/fpm/fpm_main.c index c5972f10d180..7071f26a237c 100644 --- a/sapi/fpm/fpm/fpm_main.c +++ b/sapi/fpm/fpm/fpm_main.c @@ -93,6 +93,9 @@ int __riscosify_control = __RISCOSIFY_STRICT_UNIX_SPECS; #include "fpm_log.h" #include "zlog.h" +#include +#include // for strerror() + /* XXX this will need to change later when threaded fastcgi is implemented. shane */ struct sigaction act, old_term, old_quit, old_int; diff --git a/sapi/phpdbg/phpdbg_io.c b/sapi/phpdbg/phpdbg_io.c index 14ae71a0ebd1..6cf827c1be01 100644 --- a/sapi/phpdbg/phpdbg_io.c +++ b/sapi/phpdbg/phpdbg_io.c @@ -20,6 +20,8 @@ #include "phpdbg_io.h" +#include + ZEND_EXTERN_MODULE_GLOBALS(phpdbg) /* is easy to generalize ... but not needed for now */ From 377176284a253898c454b0b83044b5d1c0d06523 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Wed, 4 Jan 2023 10:28:20 +0100 Subject: [PATCH 10/14] Zend/zend_{operators,variables}: include cleanup --- Zend/zend.c | 1 + Zend/zend_operators.c | 8 +++++--- Zend/zend_operators.h | 13 ++++++------- Zend/zend_variables.c | 2 +- Zend/zend_variables.h | 1 + 5 files changed, 14 insertions(+), 11 deletions(-) diff --git a/Zend/zend.c b/Zend/zend.c index 0eec5f89019d..99d3cc027090 100644 --- a/Zend/zend.c +++ b/Zend/zend.c @@ -36,6 +36,7 @@ #include "zend_observer.h" #include "zend_fibers.h" #include "zend_call_stack.h" +#include "zend_strtod.h" #include "Optimizer/zend_optimizer.h" static size_t global_map_ptr_last = 0; diff --git a/Zend/zend_operators.c b/Zend/zend_operators.c index afe068bfeb8d..e3b899c2b5df 100644 --- a/Zend/zend_operators.c +++ b/Zend/zend_operators.c @@ -18,18 +18,20 @@ +----------------------------------------------------------------------+ */ -#include - -#include "zend.h" #include "zend_operators.h" +#include "zend.h" #include "zend_variables.h" +#include "zend_objects.h" // for zend_objects_new() #include "zend_globals.h" +#include "zend_multiply.h" // for ZEND_SIGNED_MULTIPLY_LONG() #include "zend_list.h" #include "zend_API.h" #include "zend_strtod.h" #include "zend_exceptions.h" #include "zend_closures.h" +#include + #include #ifdef HAVE_LANGINFO_H # include diff --git a/Zend/zend_operators.h b/Zend/zend_operators.h index 506c27fc50eb..f448c7bd5670 100644 --- a/Zend/zend_operators.h +++ b/Zend/zend_operators.h @@ -21,20 +21,19 @@ #ifndef ZEND_OPERATORS_H #define ZEND_OPERATORS_H -#include +#include "zend_hash.h" // for zend_hash_num_elements() +#include "zend_object_handlers.h" // for struct _zend_object_handlers +#include "zend_portability.h" // for BEGIN_EXTERN_ +#include "zend_types.h" // for zend_result +#include "zend_string.h" // for zend_string_copy() + #include -#include #include #ifdef HAVE_IEEEFP_H #include #endif -#include "zend_portability.h" -#include "zend_strtod.h" -#include "zend_multiply.h" -#include "zend_object_handlers.h" - #define LONG_SIGN_MASK ZEND_LONG_MIN BEGIN_EXTERN_C() diff --git a/Zend/zend_variables.c b/Zend/zend_variables.c index 06483d581df3..69cb54dbc7db 100644 --- a/Zend/zend_variables.c +++ b/Zend/zend_variables.c @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -#include +#include "zend_variables.h" #include "zend.h" #include "zend_API.h" #include "zend_ast.h" diff --git a/Zend/zend_variables.h b/Zend/zend_variables.h index ea3fd9c5efcb..c07fdfe7acf0 100644 --- a/Zend/zend_variables.h +++ b/Zend/zend_variables.h @@ -21,6 +21,7 @@ #ifndef ZEND_VARIABLES_H #define ZEND_VARIABLES_H +#include "zend_hash.h" // for zend_array_dup() #include "zend_types.h" #include "zend_gc.h" From 05b06f8fdc829a351ac3d2fa6de1e8c4338cd226 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Wed, 4 Jan 2023 09:15:15 +0100 Subject: [PATCH 11/14] Zend/zend_object_handlers: include cleanup --- Zend/zend_object_handlers.c | 2 +- Zend/zend_object_handlers.h | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/Zend/zend_object_handlers.c b/Zend/zend_object_handlers.c index c5af76e97b66..923dce597296 100644 --- a/Zend/zend_object_handlers.c +++ b/Zend/zend_object_handlers.c @@ -18,13 +18,13 @@ +----------------------------------------------------------------------+ */ +#include "zend_object_handlers.h" #include "zend.h" #include "zend_globals.h" #include "zend_variables.h" #include "zend_API.h" #include "zend_objects.h" #include "zend_objects_API.h" -#include "zend_object_handlers.h" #include "zend_interfaces.h" #include "zend_exceptions.h" #include "zend_closures.h" diff --git a/Zend/zend_object_handlers.h b/Zend/zend_object_handlers.h index 79bace920284..4d78c70cf20a 100644 --- a/Zend/zend_object_handlers.h +++ b/Zend/zend_object_handlers.h @@ -20,6 +20,8 @@ #ifndef ZEND_OBJECT_HANDLERS_H #define ZEND_OBJECT_HANDLERS_H +#include "zend_types.h" + struct _zend_property_info; #define ZEND_WRONG_PROPERTY_INFO \ From 2c9ecaca8b2289a07561f6441d4d321d8057e1cb Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Wed, 4 Jan 2023 21:03:33 +0100 Subject: [PATCH 12/14] Zend/zend_ptr_stack: include cleanup --- Zend/zend_ptr_stack.c | 2 +- Zend/zend_ptr_stack.h | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/Zend/zend_ptr_stack.c b/Zend/zend_ptr_stack.c index 80c77e11d73e..acecae477e3a 100644 --- a/Zend/zend_ptr_stack.c +++ b/Zend/zend_ptr_stack.c @@ -17,8 +17,8 @@ +----------------------------------------------------------------------+ */ -#include "zend.h" #include "zend_ptr_stack.h" + #include ZEND_API void zend_ptr_stack_init_ex(zend_ptr_stack *stack, bool persistent) diff --git a/Zend/zend_ptr_stack.h b/Zend/zend_ptr_stack.h index 1126da5800d1..b1dc6c29af3a 100644 --- a/Zend/zend_ptr_stack.h +++ b/Zend/zend_ptr_stack.h @@ -20,6 +20,9 @@ #ifndef ZEND_PTR_STACK_H #define ZEND_PTR_STACK_H +#include "zend_alloc.h" // for safe_perealloc() +#include "zend_portability.h" // for BEGIN_EXTERN_C + typedef struct _zend_ptr_stack { int top, max; void **elements; From 066fc53134dc93ea385aa506cfe62cec9885b55e Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Wed, 4 Jan 2023 21:15:08 +0100 Subject: [PATCH 13/14] Zend/zend_multibyte: include cleanup --- Zend/zend_multibyte.c | 6 +++--- Zend/zend_multibyte.h | 6 ++++++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/Zend/zend_multibyte.c b/Zend/zend_multibyte.c index f8dab668751a..fc07a2be6af5 100644 --- a/Zend/zend_multibyte.c +++ b/Zend/zend_multibyte.c @@ -17,10 +17,10 @@ +----------------------------------------------------------------------+ */ -#include "zend.h" -#include "zend_compile.h" -#include "zend_operators.h" #include "zend_multibyte.h" +#include "zend_alloc.h" +#include "zend_globals.h" // for struct _zend_compiler_globals +#include "zend_globals_macros.h" // for LANG_SCNG() #include "zend_ini.h" static const zend_encoding *dummy_encoding_fetcher(const char *encoding_name) diff --git a/Zend/zend_multibyte.h b/Zend/zend_multibyte.h index 5466840cd900..08ee63089759 100644 --- a/Zend/zend_multibyte.h +++ b/Zend/zend_multibyte.h @@ -20,6 +20,12 @@ #ifndef ZEND_MULTIBYTE_H #define ZEND_MULTIBYTE_H +#include "zend_portability.h" // for BEGIN_EXTERN_C +#include "zend_types.h" // for zend_result + +#include +#include // for size_t + typedef struct _zend_encoding zend_encoding; typedef size_t (*zend_encoding_filter)(unsigned char **str, size_t *str_length, const unsigned char *buf, size_t length); From 4eb61b3d000aa239f3a33a317daa4513d7955045 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Wed, 4 Jan 2023 09:19:19 +0100 Subject: [PATCH 14/14] Zend/zend_execute: include cleanup --- Zend/zend_execute.c | 26 ++++++++++---------------- Zend/zend_execute.h | 14 ++++++++++---- Zend/zend_execute_API.c | 16 ++++------------ 3 files changed, 24 insertions(+), 32 deletions(-) diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c index dc2e0d4953bd..02a044727275 100644 --- a/Zend/zend_execute.c +++ b/Zend/zend_execute.c @@ -20,34 +20,25 @@ #define ZEND_INTENSIVE_DEBUGGING 0 -#include -#include - -#include "zend.h" -#include "zend_compile.h" #include "zend_execute.h" -#include "zend_API.h" -#include "zend_ptr_stack.h" +#include "zend_API.h" // for ZEND_FUNCTION() +#include "zend_arena.h" #include "zend_constants.h" #include "zend_extensions.h" #include "zend_ini.h" #include "zend_exceptions.h" -#include "zend_interfaces.h" #include "zend_closures.h" -#include "zend_generators.h" -#include "zend_vm.h" -#include "zend_dtrace.h" -#include "zend_inheritance.h" -#include "zend_type_info.h" +#include "zend_generators.h" // for zend_ce_generator +#include "zend_inheritance.h" // for zend_do_link_class() #include "zend_smart_str.h" #include "zend_observer.h" -#include "zend_system_id.h" -#include "zend_call_stack.h" -#include "Optimizer/zend_func_info.h" /* Virtual current working directory support */ #include "zend_virtual_cwd.h" +#include +#include + #ifdef HAVE_GCC_GLOBAL_REGS # if defined(__GNUC__) && ZEND_GCC_VERSION >= 4008 && defined(i386) # define ZEND_VM_FP_GLOBAL_REG "%esi" @@ -5283,6 +5274,9 @@ static zend_always_inline zend_execute_data *_zend_vm_stack_push_call_frame(uint /* This callback disables optimization of "vm_stack_data" variable in VM */ ZEND_API void (ZEND_FASTCALL *zend_touch_vm_stack_data)(void *vm_stack_data) = NULL; +#include "zend_fibers.h" // needed by zend_vm_execute.h +#include "zend_interfaces.h" // needed by zend_vm_execute.h +#include "zend_objects.h" // needed by zend_vm_execute.h #include "zend_vm_execute.h" ZEND_API zend_result zend_set_user_opcode_handler(zend_uchar opcode, user_opcode_handler_t handler) diff --git a/Zend/zend_execute.h b/Zend/zend_execute.h index de53305090c1..b7aa52764718 100644 --- a/Zend/zend_execute.h +++ b/Zend/zend_execute.h @@ -21,10 +21,15 @@ #ifndef ZEND_EXECUTE_H #define ZEND_EXECUTE_H -#include "zend_compile.h" -#include "zend_hash.h" -#include "zend_operators.h" -#include "zend_variables.h" +#include "zend_compile.h" // for zend_op_array +#include "zend_list.h" // for zend_rsrc_list_get_rsrc_type() +#include "zend_portability.h" // for BEGIN_EXTERN_C +#include "zend_types.h" // for zend_execute_data + +#if ZEND_DEBUG +#include "zend_globals.h" // for struct _zend_executor_globals +#include "zend_globals_macros.h" // for EG() +#endif BEGIN_EXTERN_C() struct _zend_fcall_info; @@ -182,6 +187,7 @@ ZEND_API zend_result ZEND_FASTCALL zval_update_constant_ex(zval *pp, zend_class_ ZEND_API zend_result ZEND_FASTCALL zval_update_constant_with_ctx(zval *pp, zend_class_entry *scope, zend_ast_evaluate_ctx *ctx); /* dedicated Zend executor functions - do not use! */ +typedef struct _zend_vm_stack *zend_vm_stack; struct _zend_vm_stack { zval *top; zval *end; diff --git a/Zend/zend_execute_API.c b/Zend/zend_execute_API.c index 17c3caae2143..066c45d1eb40 100644 --- a/Zend/zend_execute_API.c +++ b/Zend/zend_execute_API.c @@ -18,26 +18,18 @@ +----------------------------------------------------------------------+ */ -#include -#include - -#include "zend.h" -#include "zend_compile.h" -#include "zend_execute.h" #include "zend_API.h" -#include "zend_stack.h" #include "zend_constants.h" #include "zend_extensions.h" #include "zend_exceptions.h" #include "zend_closures.h" -#include "zend_generators.h" -#include "zend_vm.h" -#include "zend_float.h" #include "zend_fibers.h" #include "zend_weakrefs.h" -#include "zend_inheritance.h" #include "zend_observer.h" -#include "zend_call_stack.h" + +#include +#include + #ifdef HAVE_SYS_TIME_H #include #endif