xref: /PHP-8.1/main/php_globals.h (revision 3ccc0409)
1 /*
2    +----------------------------------------------------------------------+
3    | Copyright (c) The PHP Group                                          |
4    +----------------------------------------------------------------------+
5    | This source file is subject to version 3.01 of the PHP license,      |
6    | that is bundled with this package in the file LICENSE, and is        |
7    | available through the world-wide-web at the following url:           |
8    | https://www.php.net/license/3_01.txt                                 |
9    | If you did not receive a copy of the PHP license and are unable to   |
10    | obtain it through the world-wide-web, please send a note to          |
11    | license@php.net so we can mail you a copy immediately.               |
12    +----------------------------------------------------------------------+
13    | Author: Zeev Suraski <zeev@php.net>                                  |
14    +----------------------------------------------------------------------+
15 */
16 
17 #ifndef PHP_GLOBALS_H
18 #define PHP_GLOBALS_H
19 
20 #include "zend_globals.h"
21 
22 typedef struct _php_core_globals php_core_globals;
23 
24 #ifdef ZTS
25 # define PG(v) ZEND_TSRMG_FAST(core_globals_offset, php_core_globals *, v)
26 extern PHPAPI int core_globals_id;
27 extern PHPAPI size_t core_globals_offset;
28 #else
29 # define PG(v) (core_globals.v)
30 extern ZEND_API struct _php_core_globals core_globals;
31 #endif
32 
33 /* Error display modes */
34 #define PHP_DISPLAY_ERRORS_STDOUT	1
35 #define PHP_DISPLAY_ERRORS_STDERR	2
36 
37 /* Track vars */
38 #define TRACK_VARS_POST		0
39 #define TRACK_VARS_GET		1
40 #define TRACK_VARS_COOKIE	2
41 #define TRACK_VARS_SERVER	3
42 #define TRACK_VARS_ENV		4
43 #define TRACK_VARS_FILES	5
44 #define TRACK_VARS_REQUEST	6
45 
46 struct _php_tick_function_entry;
47 
48 typedef struct _arg_separators {
49 	char *output;
50 	char *input;
51 } arg_separators;
52 
53 struct _php_core_globals {
54 	bool implicit_flush;
55 
56 	zend_long output_buffering;
57 
58 	bool enable_dl;
59 
60 	char *output_handler;
61 
62 	char *unserialize_callback_func;
63 	zend_long serialize_precision;
64 
65 	zend_long memory_limit;
66 	zend_long max_input_time;
67 
68 	zend_uchar display_errors;
69 	bool display_startup_errors;
70 	bool log_errors;
71 	bool ignore_repeated_errors;
72 	bool ignore_repeated_source;
73 	bool report_memleaks;
74 	char *error_log;
75 
76 	char *doc_root;
77 	char *user_dir;
78 	char *include_path;
79 	char *open_basedir;
80 	char *extension_dir;
81 	char *php_binary;
82 	char *sys_temp_dir;
83 
84 	char *upload_tmp_dir;
85 	zend_long upload_max_filesize;
86 
87 	char *error_append_string;
88 	char *error_prepend_string;
89 
90 	char *auto_prepend_file;
91 	char *auto_append_file;
92 
93 	char *input_encoding;
94 	char *internal_encoding;
95 	char *output_encoding;
96 
97 	arg_separators arg_separator;
98 
99 	char *variables_order;
100 
101 	HashTable rfc1867_protected_variables;
102 
103 	short connection_status;
104 	bool ignore_user_abort;
105 
106 	unsigned char header_is_being_sent;
107 
108 	zend_llist tick_functions;
109 
110 	zval http_globals[6];
111 
112 	bool expose_php;
113 
114 	bool register_argc_argv;
115 	bool auto_globals_jit;
116 
117 	char *docref_root;
118 	char *docref_ext;
119 
120 	bool html_errors;
121 	bool xmlrpc_errors;
122 
123 	zend_long xmlrpc_error_number;
124 
125 	bool activated_auto_globals[8];
126 
127 	bool modules_activated;
128 	bool file_uploads;
129 	bool during_request_startup;
130 	bool allow_url_fopen;
131 	bool enable_post_data_reading;
132 	bool report_zend_debug;
133 
134 	int last_error_type;
135 	zend_string *last_error_message;
136 	zend_string *last_error_file;
137 	int  last_error_lineno;
138 
139 	char *php_sys_temp_dir;
140 
141 	char *disable_classes;
142 	bool allow_url_include;
143 #ifdef PHP_WIN32
144 	bool com_initialized;
145 #endif
146 	zend_long max_input_nesting_level;
147 	zend_long max_input_vars;
148 	bool in_user_include;
149 
150 	char *user_ini_filename;
151 	zend_long user_ini_cache_ttl;
152 
153 	char *request_order;
154 
155 	bool mail_x_header;
156 	char *mail_log;
157 
158 	bool in_error_log;
159 
160 #ifdef PHP_WIN32
161 	bool windows_show_crt_warning;
162 #endif
163 
164 	zend_long syslog_facility;
165 	char *syslog_ident;
166 	bool have_called_openlog;
167 	zend_long syslog_filter;
168 };
169 
170 
171 #endif /* PHP_GLOBALS_H */
172