xref: /php-src/main/php_globals.h (revision 127ad707)
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 #include <stdint.h>
23 
24 typedef struct _php_core_globals php_core_globals;
25 
26 #ifdef ZTS
27 # define PG(v) ZEND_TSRMG_FAST(core_globals_offset, php_core_globals *, v)
28 extern PHPAPI int core_globals_id;
29 extern PHPAPI size_t core_globals_offset;
30 #else
31 # define PG(v) (core_globals.v)
32 extern ZEND_API struct _php_core_globals core_globals;
33 #endif
34 
35 /* Error display modes */
36 #define PHP_DISPLAY_ERRORS_STDOUT	1
37 #define PHP_DISPLAY_ERRORS_STDERR	2
38 
39 /* Track vars */
40 #define TRACK_VARS_POST		0
41 #define TRACK_VARS_GET		1
42 #define TRACK_VARS_COOKIE	2
43 #define TRACK_VARS_SERVER	3
44 #define TRACK_VARS_ENV		4
45 #define TRACK_VARS_FILES	5
46 #define TRACK_VARS_REQUEST	6
47 
48 struct _php_tick_function_entry;
49 
50 typedef struct _arg_separators {
51 	char *output;
52 	char *input;
53 } arg_separators;
54 
55 struct _php_core_globals {
56 	zend_long output_buffering;
57 
58 	bool implicit_flush;
59 
60 	bool enable_dl;
61 
62 	uint8_t display_errors;
63 	bool display_startup_errors;
64 	bool log_errors;
65 	bool ignore_repeated_errors;
66 	bool ignore_repeated_source;
67 	bool report_memleaks;
68 
69 	char *output_handler;
70 
71 	char *unserialize_callback_func;
72 	zend_long serialize_precision;
73 
74 	zend_long memory_limit;
75 	zend_long max_input_time;
76 
77 	char *error_log;
78 
79 	char *doc_root;
80 	char *user_dir;
81 	char *include_path;
82 	char *open_basedir;
83 	bool open_basedir_modified;
84 	char *extension_dir;
85 	char *php_binary;
86 	char *sys_temp_dir;
87 
88 	char *upload_tmp_dir;
89 	zend_long upload_max_filesize;
90 
91 	char *error_append_string;
92 	char *error_prepend_string;
93 
94 	char *auto_prepend_file;
95 	char *auto_append_file;
96 
97 	char *input_encoding;
98 	char *internal_encoding;
99 	char *output_encoding;
100 
101 	arg_separators arg_separator;
102 
103 	char *variables_order;
104 
105 	HashTable rfc1867_protected_variables;
106 
107 	short connection_status;
108 	bool ignore_user_abort;
109 
110 	unsigned char header_is_being_sent;
111 
112 	zend_llist tick_functions;
113 
114 	zval http_globals[6];
115 
116 	bool expose_php;
117 
118 	bool register_argc_argv;
119 	bool auto_globals_jit;
120 
121 	bool html_errors;
122 	bool xmlrpc_errors;
123 
124 	char *docref_root;
125 	char *docref_ext;
126 
127 	zend_long xmlrpc_error_number;
128 
129 	bool activated_auto_globals[8];
130 
131 	bool modules_activated;
132 	bool file_uploads;
133 	bool during_request_startup;
134 	bool allow_url_fopen;
135 	bool enable_post_data_reading;
136 	bool report_zend_debug;
137 
138 	int last_error_type;
139 	int last_error_lineno;
140 	zend_string *last_error_message;
141 	zend_string *last_error_file;
142 
143 	char *php_sys_temp_dir;
144 
145 	char *disable_classes;
146 	zend_long max_input_nesting_level;
147 	zend_long max_input_vars;
148 
149 	char *user_ini_filename;
150 	zend_long user_ini_cache_ttl;
151 
152 	char *request_order;
153 
154 	char *mail_log;
155 	bool mail_x_header;
156 	bool mail_mixed_lf_and_crlf;
157 
158 	bool in_error_log;
159 
160 	bool allow_url_include;
161 #ifdef PHP_WIN32
162 	bool com_initialized;
163 #endif
164 	bool in_user_include;
165 
166 #ifdef PHP_WIN32
167 	bool windows_show_crt_warning;
168 #endif
169 
170 	bool have_called_openlog;
171 	zend_long syslog_facility;
172 	char *syslog_ident;
173 	zend_long syslog_filter;
174 	zend_long error_log_mode;
175 };
176 
177 
178 #endif /* PHP_GLOBALS_H */
179