- Notifications
You must be signed in to change notification settings - Fork 7.8k
/
Copy pathphp.h
443 lines (366 loc) · 11.7 KB
/
php.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
/*
+----------------------------------------------------------------------+
| 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. |
+----------------------------------------------------------------------+
| Authors: Andi Gutmans <andi@php.net> |
| Zeev Suraski <zeev@php.net> |
+----------------------------------------------------------------------+
*/
#ifndefPHP_H
#definePHP_H
#ifdefHAVE_DMALLOC
#include<dmalloc.h>
#endif
#definePHP_API_VERSION 20230831
#definePHP_HAVE_STREAMS
#defineYYDEBUG 0
#definePHP_DEFAULT_CHARSET "UTF-8"
#include"php_version.h"
#include"zend.h"
#include"zend_sort.h"
#include"php_compat.h"
#include"zend_API.h"
#definephp_sprintf sprintf
/* Operating system family definition */
#ifdefPHP_WIN32
# definePHP_OS_FAMILY "Windows"
#elif defined(BSD) || defined(__DragonFly__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
# definePHP_OS_FAMILY "BSD"
#elif defined(__APPLE__) || defined(__MACH__)
# definePHP_OS_FAMILY "Darwin"
#elif defined(__sun__)
# definePHP_OS_FAMILY "Solaris"
#elif defined(__linux__)
# definePHP_OS_FAMILY "Linux"
#else
# definePHP_OS_FAMILY "Unknown"
#endif
/* PHP's DEBUG value must match Zend's ZEND_DEBUG value */
#undef PHP_DEBUG
#definePHP_DEBUG ZEND_DEBUG
#ifdefPHP_WIN32
# include"tsrm_win32.h"
# ifdefPHP_EXPORTS
# definePHPAPI __declspec(dllexport)
# else
# definePHPAPI __declspec(dllimport)
# endif
# definePHP_DIR_SEPARATOR '\\'
# definePHP_EOL "\r\n"
#else
# if defined(__GNUC__) &&__GNUC__ >= 4
# definePHPAPI __attribute__ ((visibility("default")))
# else
# definePHPAPI
# endif
# definePHP_DIR_SEPARATOR '/'
# definePHP_EOL "\n"
#endif
/* Windows specific defines */
#ifdefPHP_WIN32
# definePHP_PROG_SENDMAIL "Built in mailer"
# defineWIN32_LEAN_AND_MEAN
# defineNOOPENFILE
# include<io.h>
# include<malloc.h>
# include<direct.h>
# include<stdlib.h>
# include<stdio.h>
# include<stdarg.h>
# include<sys/types.h>
# include<process.h>
typedefintuid_t;
typedefintgid_t;
typedefchar*caddr_t;
typedefintpid_t;
# defineM_TWOPI (M_PI * 2.0)
# defineoff_t _off_t
# definelstat(x, y) php_sys_lstat(x, y)
# definechdir(path) _chdir(path)
# definemkdir(a, b) _mkdir(a)
# definermdir(a) _rmdir(a)
# definegetpid _getpid
# definephp_sleep(t) SleepEx(t*1000, TRUE)
# ifndefgetcwd
# definegetcwd(a, b) _getcwd(a, b)
# endif
#endif
#ifPHP_DEBUG
#undef NDEBUG
#else
#ifndefNDEBUG
#defineNDEBUG
#endif
#endif
#include<assert.h>
#ifdefHAVE_UNIX_H
#include<unix.h>
#endif
#ifHAVE_ALLOCA_H
#include<alloca.h>
#endif
#ifHAVE_BUILD_DEFS_H
#include<build-defs.h>
#endif
/*
* This is a fast version of strlcpy which should be used, if you
* know the size of the destination buffer and if you know
* the length of the source string.
*
* size is the allocated number of bytes of dst
* src_size is the number of bytes excluding the NUL of src
*/
#definePHP_STRLCPY(dst, src, size, src_size) \
{ \
size_t php_str_len; \
\
if (src_size >= size) \
php_str_len = size - 1; \
else \
php_str_len = src_size; \
memcpy(dst, src, php_str_len); \
dst[php_str_len] = '\0'; \
}
#ifndefHAVE_STRLCPY
BEGIN_EXTERN_C()
PHPAPIsize_tphp_strlcpy(char*dst, constchar*src, size_tsiz);
END_EXTERN_C()
#undef strlcpy
#definestrlcpy php_strlcpy
#defineHAVE_STRLCPY 1
#defineUSE_STRLCPY_PHP_IMPL 1
#endif
#ifndefHAVE_STRLCAT
BEGIN_EXTERN_C()
PHPAPIsize_tphp_strlcat(char*dst, constchar*src, size_tsiz);
END_EXTERN_C()
#undef strlcat
#definestrlcat php_strlcat
#defineHAVE_STRLCAT 1
#defineUSE_STRLCAT_PHP_IMPL 1
#endif
#ifndefHAVE_EXPLICIT_BZERO
BEGIN_EXTERN_C()
PHPAPIvoidphp_explicit_bzero(void*dst, size_tsiz);
END_EXTERN_C()
#undef explicit_bzero
#defineexplicit_bzero php_explicit_bzero
#endif
BEGIN_EXTERN_C()
PHPAPIintphp_safe_bcmp(constzend_string*a, constzend_string*b);
END_EXTERN_C()
#ifndefHAVE_STRTOK_R
BEGIN_EXTERN_C()
char*strtok_r(char*s, constchar*delim, char**last);
END_EXTERN_C()
#endif
#ifndefHAVE_SOCKLEN_T
# ifdefPHP_WIN32
typedefintsocklen_t;
# else
typedefunsigned intsocklen_t;
# endif
#endif
#defineCREATE_MUTEX(a, b)
#defineSET_MUTEX(a)
#defineFREE_MUTEX(a)
/*
* Then the ODBC support can use both iodbc and Solid,
* uncomment this.
* #define HAVE_ODBC (HAVE_IODBC|HAVE_SOLID)
*/
#include<stdlib.h>
#include<ctype.h>
#ifHAVE_UNISTD_H
#include<unistd.h>
#endif
#include<stdarg.h>
#include"zend_hash.h"
#include"zend_alloc.h"
#include"zend_stack.h"
#include<string.h>
#ifHAVE_PWD_H
# ifdefPHP_WIN32
#include"win32/param.h"
# else
#include<pwd.h>
#include<sys/param.h>
# endif
#endif
#include<limits.h>
#ifndefLONG_MAX
#defineLONG_MAX 2147483647L
#endif
#ifndefLONG_MIN
#defineLONG_MIN (- LONG_MAX - 1)
#endif
#ifndefINT_MAX
#defineINT_MAX 2147483647
#endif
#ifndefINT_MIN
#defineINT_MIN (- INT_MAX - 1)
#endif
#definePHP_DOUBLE_MAX_LENGTH ZEND_DOUBLE_MAX_LENGTH
#definePHP_GCC_VERSION ZEND_GCC_VERSION
#definePHP_ATTRIBUTE_MALLOC ZEND_ATTRIBUTE_MALLOC
#definePHP_ATTRIBUTE_FORMAT ZEND_ATTRIBUTE_FORMAT
BEGIN_EXTERN_C()
#include"snprintf.h"
END_EXTERN_C()
#include"spprintf.h"
#defineEXEC_INPUT_BUF 4096
#definePHP_MIME_TYPE "application/x-httpd-php"
/* macros */
#defineSTR_PRINT(str) ((str)?(str):"")
#ifndefMAXPATHLEN
# ifdefPHP_WIN32
# include"win32/ioutil.h"
# defineMAXPATHLEN PHP_WIN32_IOUTIL_MAXPATHLEN
# elifPATH_MAX
# defineMAXPATHLEN PATH_MAX
# elif defined(MAX_PATH)
# defineMAXPATHLEN MAX_PATH
# else
# defineMAXPATHLEN 256 /* Should be safe for any weird systems that do not define it */
# endif
#endif
#definephp_ignore_value(x) ZEND_IGNORE_VALUE(x)
/* global variables */
#ifndefPHP_WIN32
#definephp_sleep sleep
externchar**environ;
#endif/* ifndef PHP_WIN32 */
#ifdefPHP_PWRITE_64
ssize_tpwrite(int, void*, size_t, off64_t);
#endif
#ifdefPHP_PREAD_64
ssize_tpread(int, void*, size_t, off64_t);
#endif
BEGIN_EXTERN_C()
voidphperror(char*error);
PHPAPIsize_tphp_write(void*buf, size_tsize);
PHPAPIsize_tphp_printf(constchar*format, ...) PHP_ATTRIBUTE_FORMAT(printf, 1, 2);
PHPAPIsize_tphp_printf_unchecked(constchar*format, ...);
PHPAPIboolphp_during_module_startup(void);
PHPAPIboolphp_during_module_shutdown(void);
PHPAPIboolphp_get_module_initialized(void);
#ifdefHAVE_SYSLOG_H
#include"php_syslog.h"
#definephp_log_err(msg) php_log_err_with_severity(msg, LOG_NOTICE)
#else
#definephp_log_err(msg) php_log_err_with_severity(msg, 5)
#endif
PHPAPIZEND_COLDvoidphp_log_err_with_severity(constchar*log_message, intsyslog_type_int);
intDebug(char*format, ...) PHP_ATTRIBUTE_FORMAT(printf, 1, 2);
intcfgparse(void);
END_EXTERN_C()
#definephp_error zend_error
#defineerror_handling_t zend_error_handling_t
BEGIN_EXTERN_C()
staticinlineZEND_ATTRIBUTE_DEPRECATEDvoidphp_set_error_handling(error_handling_terror_handling, zend_class_entry*exception_class)
{
zend_replace_error_handling(error_handling, exception_class, NULL);
}
staticinlineZEND_ATTRIBUTE_DEPRECATEDvoidphp_std_error_handling(void) {}
PHPAPIZEND_COLDvoidphp_verror(constchar*docref, constchar*params, inttype, constchar*format, va_listargs) PHP_ATTRIBUTE_FORMAT(printf, 4, 0);
/* PHPAPI void php_error(int type, const char *format, ...); */
PHPAPIZEND_COLDvoidphp_error_docref(constchar*docref, inttype, constchar*format, ...)
PHP_ATTRIBUTE_FORMAT(printf, 3, 4);
PHPAPIZEND_COLDvoidphp_error_docref1(constchar*docref, constchar*param1, inttype, constchar*format, ...)
PHP_ATTRIBUTE_FORMAT(printf, 4, 5);
PHPAPIZEND_COLDvoidphp_error_docref2(constchar*docref, constchar*param1, constchar*param2, inttype, constchar*format, ...)
PHP_ATTRIBUTE_FORMAT(printf, 5, 6);
#ifdefPHP_WIN32
PHPAPIZEND_COLDvoidphp_win32_docref1_from_error(DWORDerror, constchar*param1);
PHPAPIZEND_COLDvoidphp_win32_docref2_from_error(DWORDerror, constchar*param1, constchar*param2);
#endif
END_EXTERN_C()
#definezenderror phperror
#definezendlex phplex
#definephpparse zendparse
#definephprestart zendrestart
#definephpin zendin
#definephp_memnstr zend_memnstr
#definephp_memnistr zend_memnistr
/* functions */
BEGIN_EXTERN_C()
PHPAPIexternint (*php_register_internal_extensions_func)(void);
PHPAPIintphp_register_internal_extensions(void);
PHPAPIvoidphp_register_pre_request_shutdown(void (*func)(void*), void*userdata);
PHPAPIvoidphp_com_initialize(void);
PHPAPIchar*php_get_current_user(void);
PHPAPIconstchar*php_get_internal_encoding(void);
PHPAPIconstchar*php_get_input_encoding(void);
PHPAPIconstchar*php_get_output_encoding(void);
PHPAPIexternvoid (*php_internal_encoding_changed)(void);
END_EXTERN_C()
/* PHP-named Zend macro wrappers */
#definePHP_FN ZEND_FN
#definePHP_MN ZEND_MN
#definePHP_NAMED_FUNCTION ZEND_NAMED_FUNCTION
#definePHP_FUNCTION ZEND_FUNCTION
#definePHP_METHOD ZEND_METHOD
#definePHP_RAW_NAMED_FE ZEND_RAW_NAMED_FE
#definePHP_NAMED_FE ZEND_NAMED_FE
#definePHP_FE ZEND_FE
#definePHP_DEP_FE ZEND_DEP_FE
#definePHP_FALIAS ZEND_FALIAS
#definePHP_DEP_FALIAS ZEND_DEP_FALIAS
#definePHP_ME ZEND_ME
#definePHP_MALIAS ZEND_MALIAS
#definePHP_ABSTRACT_ME ZEND_ABSTRACT_ME
#definePHP_ME_MAPPING ZEND_ME_MAPPING
#definePHP_FE_END ZEND_FE_END
#definePHP_MODULE_STARTUP_N ZEND_MODULE_STARTUP_N
#definePHP_MODULE_SHUTDOWN_N ZEND_MODULE_SHUTDOWN_N
#definePHP_MODULE_ACTIVATE_N ZEND_MODULE_ACTIVATE_N
#definePHP_MODULE_DEACTIVATE_N ZEND_MODULE_DEACTIVATE_N
#definePHP_MODULE_INFO_N ZEND_MODULE_INFO_N
#definePHP_MODULE_STARTUP_D ZEND_MODULE_STARTUP_D
#definePHP_MODULE_SHUTDOWN_D ZEND_MODULE_SHUTDOWN_D
#definePHP_MODULE_ACTIVATE_D ZEND_MODULE_ACTIVATE_D
#definePHP_MODULE_DEACTIVATE_D ZEND_MODULE_DEACTIVATE_D
#definePHP_MODULE_INFO_D ZEND_MODULE_INFO_D
/* Compatibility macros */
#definePHP_MINIT ZEND_MODULE_STARTUP_N
#definePHP_MSHUTDOWN ZEND_MODULE_SHUTDOWN_N
#definePHP_RINIT ZEND_MODULE_ACTIVATE_N
#definePHP_RSHUTDOWN ZEND_MODULE_DEACTIVATE_N
#definePHP_MINFO ZEND_MODULE_INFO_N
#definePHP_GINIT ZEND_GINIT
#definePHP_GSHUTDOWN ZEND_GSHUTDOWN
#definePHP_MINIT_FUNCTION ZEND_MODULE_STARTUP_D
#definePHP_MSHUTDOWN_FUNCTION ZEND_MODULE_SHUTDOWN_D
#definePHP_RINIT_FUNCTION ZEND_MODULE_ACTIVATE_D
#definePHP_RSHUTDOWN_FUNCTION ZEND_MODULE_DEACTIVATE_D
#definePHP_MINFO_FUNCTION ZEND_MODULE_INFO_D
#definePHP_GINIT_FUNCTION ZEND_GINIT_FUNCTION
#definePHP_GSHUTDOWN_FUNCTION ZEND_GSHUTDOWN_FUNCTION
#definePHP_MODULE_GLOBALS ZEND_MODULE_GLOBALS
/* Output support */
#include"main/php_output.h"
#include"php_streams.h"
#include"php_memory_streams.h"
#include"fopen_wrappers.h"
/* Virtual current working directory support */
#include"zend_virtual_cwd.h"
#include"zend_constants.h"
/* connection status states */
#definePHP_CONNECTION_NORMAL 0
#definePHP_CONNECTION_ABORTED 1
#definePHP_CONNECTION_TIMEOUT 2
#include"php_reentrancy.h"
/* the following typedefs are deprecated and will be removed in PHP
* 9.0; use the standard C99 types instead */
typedefboolzend_bool;
typedefintptr_tzend_intptr_t;
typedefuintptr_tzend_uintptr_t;
#endif