php-internal-docs 8.4.8
Unofficial docs for php/php-src
Loading...
Searching...
No Matches
zend.c
Go to the documentation of this file.
1/*
2 +----------------------------------------------------------------------+
3 | Zend Engine |
4 +----------------------------------------------------------------------+
5 | Copyright (c) Zend Technologies Ltd. (http://www.zend.com) |
6 +----------------------------------------------------------------------+
7 | This source file is subject to version 2.00 of the Zend license, |
8 | that is bundled with this package in the file LICENSE, and is |
9 | available through the world-wide-web at the following url: |
10 | http://www.zend.com/license/2_00.txt. |
11 | If you did not receive a copy of the Zend license and are unable to |
12 | obtain it through the world-wide-web, please send a note to |
13 | license@zend.com so we can mail you a copy immediately. |
14 +----------------------------------------------------------------------+
15 | Authors: Andi Gutmans <andi@php.net> |
16 | Zeev Suraski <zeev@php.net> |
17 +----------------------------------------------------------------------+
18*/
19
20#include "zend.h"
21#include "zend_extensions.h"
22#include "zend_modules.h"
23#include "zend_constants.h"
24#include "zend_list.h"
25#include "zend_API.h"
26#include "zend_exceptions.h"
28#include "zend_ini.h"
29#include "zend_vm.h"
30#include "zend_dtrace.h"
31#include "zend_virtual_cwd.h"
32#include "zend_smart_str.h"
33#include "zend_smart_string.h"
34#include "zend_cpuinfo.h"
35#include "zend_attributes.h"
36#include "zend_observer.h"
37#include "zend_fibers.h"
38#include "zend_call_stack.h"
40#include "zend_hrtime.h"
42#include "php.h"
43#include "php_globals.h"
44
45// FIXME: Breaks the declaration of the function below
46#undef zenderror
47
48static size_t global_map_ptr_last = 0;
49static bool startup_done = false;
50
51#ifdef ZTS
52ZEND_API int compiler_globals_id;
53ZEND_API int executor_globals_id;
54ZEND_API size_t compiler_globals_offset;
55ZEND_API size_t executor_globals_offset;
56static HashTable *global_function_table = NULL;
57static HashTable *global_class_table = NULL;
58static HashTable *global_constants_table = NULL;
59static HashTable *global_auto_globals_table = NULL;
60static HashTable *global_persistent_list = NULL;
61TSRMLS_MAIN_CACHE_DEFINE()
62# define GLOBAL_FUNCTION_TABLE global_function_table
63# define GLOBAL_CLASS_TABLE global_class_table
64# define GLOBAL_CONSTANTS_TABLE global_constants_table
65# define GLOBAL_AUTO_GLOBALS_TABLE global_auto_globals_table
66#else
67# define GLOBAL_FUNCTION_TABLE CG(function_table)
68# define GLOBAL_CLASS_TABLE CG(class_table)
69# define GLOBAL_AUTO_GLOBALS_TABLE CG(auto_globals)
70# define GLOBAL_CONSTANTS_TABLE EG(zend_constants)
71#endif
72
75
76/* version information */
77static char *zend_version_info;
78static uint32_t zend_version_info_length;
79#define ZEND_CORE_VERSION_INFO "Zend Engine v" ZEND_VERSION ", Copyright (c) Zend Technologies\n"
80#define PRINT_ZVAL_INDENT 4
81
82/* true multithread-shared globals */
84ZEND_API size_t (*zend_printf)(const char *format, ...);
86ZEND_API FILE *(*zend_fopen)(zend_string *filename, zend_string **opened_path);
90ZEND_API void (*zend_error_cb)(int type, zend_string *error_filename, const uint32_t error_lineno, zend_string *message);
91void (*zend_printf_to_smart_string)(smart_string *buf, const char *format, va_list ap);
92void (*zend_printf_to_smart_str)(smart_str *buf, const char *format, va_list ap);
93ZEND_API char *(*zend_getenv)(const char *name, size_t name_len);
94ZEND_API zend_string *(*zend_resolve_path)(zend_string *filename);
98ZEND_ATTRIBUTE_NONNULL ZEND_API zend_result (*zend_random_bytes)(void *bytes, size_t size, char *errstr, size_t errstr_size) = NULL;
100
101/* This callback must be signal handler safe! */
102void (*zend_on_timeout)(int seconds);
103
104static void (*zend_message_dispatcher_p)(zend_long message, const void *data);
105static zval *(*zend_get_configuration_directive_p)(zend_string *name);
106
107#if ZEND_RC_DEBUG
108ZEND_API bool zend_rc_debug = 0;
109#endif
110
111static ZEND_INI_MH(OnUpdateErrorReporting) /* {{{ */
112{
113 if (!new_value) {
115 } else {
116 EG(error_reporting) = atoi(ZSTR_VAL(new_value));
117 }
118 return SUCCESS;
119}
120/* }}} */
121
122static ZEND_INI_MH(OnUpdateGCEnabled) /* {{{ */
123{
124 bool val;
125
126 val = zend_ini_parse_bool(new_value);
127 gc_enable(val);
128
129 return SUCCESS;
130}
131/* }}} */
132
133static ZEND_INI_DISP(zend_gc_enabled_displayer_cb) /* {{{ */
134{
135 if (gc_enabled()) {
136 ZEND_PUTS("On");
137 } else {
138 ZEND_PUTS("Off");
139 }
140}
141/* }}} */
142
143
144static ZEND_INI_MH(OnUpdateScriptEncoding) /* {{{ */
145{
146 if (!CG(multibyte)) {
147 return FAILURE;
148 }
150 return SUCCESS;
151 }
152 return zend_multibyte_set_script_encoding_by_string(new_value ? ZSTR_VAL(new_value) : NULL, new_value ? ZSTR_LEN(new_value) : 0);
153}
154/* }}} */
155
156static ZEND_INI_MH(OnUpdateAssertions) /* {{{ */
157{
159
160 zend_long val = zend_ini_parse_quantity_warn(new_value, entry->name);
161
162 if (stage != ZEND_INI_STAGE_STARTUP &&
163 stage != ZEND_INI_STAGE_SHUTDOWN &&
164 *p != val &&
165 (*p < 0 || val < 0)) {
166 zend_error(E_WARNING, "zend.assertions may be completely enabled or disabled only in php.ini");
167 return FAILURE;
168 }
169
170 *p = val;
171 return SUCCESS;
172}
173/* }}} */
174
175static ZEND_INI_MH(OnSetExceptionStringParamMaxLen) /* {{{ */
176{
177 zend_long i = ZEND_ATOL(ZSTR_VAL(new_value));
178 if (i >= 0 && i <= 1000000) {
179 EG(exception_string_param_max_len) = i;
180 return SUCCESS;
181 } else {
182 return FAILURE;
183 }
184}
185/* }}} */
186
187#ifdef ZEND_CHECK_STACK_LIMIT
188static ZEND_INI_MH(OnUpdateMaxAllowedStackSize) /* {{{ */
189{
190 zend_long size = zend_ini_parse_quantity_warn(new_value, entry->name);
191
192 if (size < ZEND_MAX_ALLOWED_STACK_SIZE_UNCHECKED) {
193 zend_error(E_WARNING, "Invalid \"%s\" setting. Value must be >= %d, but got " ZEND_LONG_FMT,
194 ZSTR_VAL(entry->name), ZEND_MAX_ALLOWED_STACK_SIZE_UNCHECKED, size);
195 return FAILURE;
196 }
197
198 EG(max_allowed_stack_size) = size;
199
200 return SUCCESS;
201}
202/* }}} */
203
204static ZEND_INI_MH(OnUpdateReservedStackSize) /* {{{ */
205{
206 zend_ulong size = zend_ini_parse_uquantity_warn(new_value, entry->name);
207
208 /* Min value accounts for alloca, PCRE2 START_FRAMES_SIZE, and some buffer
209 * for normal function calls.
210 * We could reduce this on systems without alloca if we also add stack size
211 * checks before pcre2_match(). */
212#ifdef ZEND_ALLOCA_MAX_SIZE
213 zend_ulong min = ZEND_ALLOCA_MAX_SIZE + 16*1024;
214#else
215 zend_ulong min = 32*1024;
216#endif
217
218#if defined(__SANITIZE_ADDRESS__) || __has_feature(memory_sanitizer)
219 /* AddressSanitizer and MemorySanitizer use more stack due to
220 * instrumentation */
221 min *= 10;
222#endif
223
224 if (size == 0) {
225 size = min;
226 } else if (size < min) {
227 zend_error(E_WARNING, "Invalid \"%s\" setting. Value must be >= " ZEND_ULONG_FMT ", but got " ZEND_ULONG_FMT "\n",
228 ZSTR_VAL(entry->name), min, size);
229 return FAILURE;
230 }
231
232 EG(reserved_stack_size) = size;
233
234 return SUCCESS;
235}
236/* }}} */
237#endif /* ZEND_CHECK_STACK_LIMIT */
238
239static ZEND_INI_MH(OnUpdateFiberStackSize) /* {{{ */
240{
241 if (new_value) {
242 zend_long tmp = zend_ini_parse_quantity_warn(new_value, entry->name);
243 if (tmp < 0) {
244 zend_error(E_WARNING, "fiber.stack_size must be a positive number");
245 return FAILURE;
246 }
247 EG(fiber_stack_size) = tmp;
248 } else {
249 EG(fiber_stack_size) = ZEND_FIBER_DEFAULT_C_STACK_SIZE;
250 }
251 return SUCCESS;
252}
253/* }}} */
254
255#if ZEND_DEBUG
256# define SIGNAL_CHECK_DEFAULT "1"
257#else
258# define SIGNAL_CHECK_DEFAULT "0"
259#endif
260
262 ZEND_INI_ENTRY("error_reporting", NULL, ZEND_INI_ALL, OnUpdateErrorReporting)
263 STD_ZEND_INI_ENTRY("zend.assertions", "1", ZEND_INI_ALL, OnUpdateAssertions, assertions, zend_executor_globals, executor_globals)
264 ZEND_INI_ENTRY3_EX("zend.enable_gc", "1", ZEND_INI_ALL, OnUpdateGCEnabled, NULL, NULL, NULL, zend_gc_enabled_displayer_cb)
265 STD_ZEND_INI_BOOLEAN("zend.multibyte", "0", ZEND_INI_PERDIR, OnUpdateBool, multibyte, zend_compiler_globals, compiler_globals)
266 ZEND_INI_ENTRY("zend.script_encoding", NULL, ZEND_INI_ALL, OnUpdateScriptEncoding)
267 STD_ZEND_INI_BOOLEAN("zend.detect_unicode", "1", ZEND_INI_ALL, OnUpdateBool, detect_unicode, zend_compiler_globals, compiler_globals)
268#ifdef ZEND_SIGNALS
269 STD_ZEND_INI_BOOLEAN("zend.signal_check", SIGNAL_CHECK_DEFAULT, ZEND_INI_SYSTEM, OnUpdateBool, check, zend_signal_globals_t, zend_signal_globals)
270#endif
271 STD_ZEND_INI_BOOLEAN("zend.exception_ignore_args", "0", ZEND_INI_ALL, OnUpdateBool, exception_ignore_args, zend_executor_globals, executor_globals)
272 STD_ZEND_INI_ENTRY("zend.exception_string_param_max_len", "15", ZEND_INI_ALL, OnSetExceptionStringParamMaxLen, exception_string_param_max_len, zend_executor_globals, executor_globals)
273 STD_ZEND_INI_ENTRY("fiber.stack_size", NULL, ZEND_INI_ALL, OnUpdateFiberStackSize, fiber_stack_size, zend_executor_globals, executor_globals)
274#ifdef ZEND_CHECK_STACK_LIMIT
275 /* The maximum allowed call stack size. 0: auto detect, -1: no limit. For fibers, this is fiber.stack_size. */
276 STD_ZEND_INI_ENTRY("zend.max_allowed_stack_size", "0", ZEND_INI_SYSTEM, OnUpdateMaxAllowedStackSize, max_allowed_stack_size, zend_executor_globals, executor_globals)
277 /* Subtracted from the max allowed stack size, as a buffer, when checking for overflow. 0: auto detect. */
278 STD_ZEND_INI_ENTRY("zend.reserved_stack_size", "0", ZEND_INI_SYSTEM, OnUpdateReservedStackSize, reserved_stack_size, zend_executor_globals, executor_globals)
279#endif
280
282
283ZEND_API size_t zend_vspprintf(char **pbuf, size_t max_len, const char *format, va_list ap) /* {{{ */
284{
285 smart_string buf = {0};
286
287 /* since there are places where (v)spprintf called without checking for null,
288 a bit of defensive coding here */
289 if (!pbuf) {
290 return 0;
291 }
292
293 zend_printf_to_smart_string(&buf, format, ap);
294
295 if (max_len && buf.len > max_len) {
296 buf.len = max_len;
297 }
298
299 smart_string_0(&buf);
300
301 if (buf.c) {
302 *pbuf = buf.c;
303 return buf.len;
304 } else {
305 *pbuf = estrndup("", 0);
306 return 0;
307 }
308}
309/* }}} */
310
311ZEND_API size_t zend_spprintf(char **message, size_t max_len, const char *format, ...) /* {{{ */
312{
313 va_list arg;
314 size_t len;
315
316 va_start(arg, format);
317 len = zend_vspprintf(message, max_len, format, arg);
318 va_end(arg);
319 return len;
320}
321/* }}} */
322
323ZEND_API size_t zend_spprintf_unchecked(char **message, size_t max_len, const char *format, ...) /* {{{ */
324{
325 va_list arg;
326 size_t len;
327
328 va_start(arg, format);
329 len = zend_vspprintf(message, max_len, format, arg);
330 va_end(arg);
331 return len;
332}
333/* }}} */
334
335ZEND_API zend_string *zend_vstrpprintf(size_t max_len, const char *format, va_list ap) /* {{{ */
336{
337 smart_str buf = {0};
338
339 zend_printf_to_smart_str(&buf, format, ap);
340
341 if (!buf.s) {
342 return ZSTR_EMPTY_ALLOC();
343 }
344
345 if (max_len && ZSTR_LEN(buf.s) > max_len) {
346 ZSTR_LEN(buf.s) = max_len;
347 }
348
349 return smart_str_extract(&buf);
350}
351/* }}} */
352
353ZEND_API zend_string *zend_strpprintf(size_t max_len, const char *format, ...) /* {{{ */
354{
355 va_list arg;
356 zend_string *str;
357
358 va_start(arg, format);
359 str = zend_vstrpprintf(max_len, format, arg);
360 va_end(arg);
361 return str;
362}
363/* }}} */
364
365ZEND_API zend_string *zend_strpprintf_unchecked(size_t max_len, const char *format, ...) /* {{{ */
366{
367 va_list arg;
368 zend_string *str;
369
370 va_start(arg, format);
371 str = zend_vstrpprintf(max_len, format, arg);
372 va_end(arg);
373 return str;
374}
375/* }}} */
376
377static void zend_print_zval_r_to_buf(smart_str *buf, zval *expr, int indent);
378
379static void print_hash(smart_str *buf, HashTable *ht, int indent, bool is_object) /* {{{ */
380{
381 zval *tmp;
382 zend_string *string_key;
383 zend_ulong num_key;
384 int i;
385
386 for (i = 0; i < indent; i++) {
387 smart_str_appendc(buf, ' ');
388 }
389 smart_str_appends(buf, "(\n");
390 indent += PRINT_ZVAL_INDENT;
391 ZEND_HASH_FOREACH_KEY_VAL_IND(ht, num_key, string_key, tmp) {
392 for (i = 0; i < indent; i++) {
393 smart_str_appendc(buf, ' ');
394 }
395 smart_str_appendc(buf, '[');
396 if (string_key) {
397 if (is_object) {
398 const char *prop_name, *class_name;
399 size_t prop_len;
400 int mangled = zend_unmangle_property_name_ex(string_key, &class_name, &prop_name, &prop_len);
401
402 smart_str_appendl(buf, prop_name, prop_len);
403 if (class_name && mangled == SUCCESS) {
404 if (class_name[0] == '*') {
405 smart_str_appends(buf, ":protected");
406 } else {
407 smart_str_appends(buf, ":");
408 smart_str_appends(buf, class_name);
409 smart_str_appends(buf, ":private");
410 }
411 }
412 } else {
413 smart_str_append(buf, string_key);
414 }
415 } else {
416 smart_str_append_long(buf, num_key);
417 }
418 smart_str_appends(buf, "] => ");
419 zend_print_zval_r_to_buf(buf, tmp, indent+PRINT_ZVAL_INDENT);
420 smart_str_appends(buf, "\n");
422 indent -= PRINT_ZVAL_INDENT;
423 for (i = 0; i < indent; i++) {
424 smart_str_appendc(buf, ' ');
425 }
426 smart_str_appends(buf, ")\n");
427}
428/* }}} */
429
430static void print_flat_hash(smart_str *buf, HashTable *ht) /* {{{ */
431{
432 zval *tmp;
433 zend_string *string_key;
434 zend_ulong num_key;
435 int i = 0;
436
437 ZEND_HASH_FOREACH_KEY_VAL_IND(ht, num_key, string_key, tmp) {
438 if (i++ > 0) {
439 smart_str_appendc(buf, ',');
440 }
441 smart_str_appendc(buf, '[');
442 if (string_key) {
443 smart_str_append(buf, string_key);
444 } else {
445 smart_str_append_unsigned(buf, num_key);
446 }
447 smart_str_appends(buf, "] => ");
450}
451/* }}} */
452
453ZEND_API bool zend_make_printable_zval(zval *expr, zval *expr_copy) /* {{{ */
454{
455 if (Z_TYPE_P(expr) == IS_STRING) {
456 return 0;
457 } else {
458 ZVAL_STR(expr_copy, zval_get_string_func(expr));
459 return 1;
460 }
461}
462/* }}} */
463
464ZEND_API size_t zend_print_zval(zval *expr, int indent) /* {{{ */
465{
466 zend_string *tmp_str;
467 zend_string *str = zval_get_tmp_string(expr, &tmp_str);
468 size_t len = ZSTR_LEN(str);
469
470 if (len != 0) {
471 zend_write(ZSTR_VAL(str), len);
472 }
473
474 zend_tmp_string_release(tmp_str);
475 return len;
476}
477/* }}} */
478
480{
481 switch (Z_TYPE_P(expr)) {
482 case IS_ARRAY:
483 smart_str_appends(buf, "Array (");
484 if (!(GC_FLAGS(Z_ARRVAL_P(expr)) & GC_IMMUTABLE)) {
485 if (GC_IS_RECURSIVE(Z_ARRVAL_P(expr))) {
486 smart_str_appends(buf, " *RECURSION*");
487 return;
488 }
490 }
491 print_flat_hash(buf, Z_ARRVAL_P(expr));
492 smart_str_appendc(buf, ')');
494 break;
495 case IS_OBJECT:
496 {
497 HashTable *properties;
498 zend_string *class_name = Z_OBJ_HANDLER_P(expr, get_class_name)(Z_OBJ_P(expr));
499 smart_str_append(buf, class_name);
500 smart_str_appends(buf, " Object (");
501 zend_string_release_ex(class_name, 0);
502
503 if (GC_IS_RECURSIVE(Z_COUNTED_P(expr))) {
504 smart_str_appends(buf, " *RECURSION*");
505 return;
506 }
507
508 properties = Z_OBJPROP_P(expr);
509 if (properties) {
511 print_flat_hash(buf, properties);
513 }
514 smart_str_appendc(buf, ')');
515 break;
516 }
517 case IS_REFERENCE:
519 break;
520 case IS_STRING:
521 smart_str_append(buf, Z_STR_P(expr));
522 break;
523 default:
524 {
526 smart_str_append(buf, str);
528 break;
529 }
530 }
531}
532/* }}} */
533
535{
536 smart_str buf = {0};
538 smart_str_0(&buf);
540 smart_str_free(&buf);
541}
542
543static void zend_print_zval_r_to_buf(smart_str *buf, zval *expr, int indent) /* {{{ */
544{
545 switch (Z_TYPE_P(expr)) {
546 case IS_ARRAY:
547 smart_str_appends(buf, "Array\n");
548 if (!(GC_FLAGS(Z_ARRVAL_P(expr)) & GC_IMMUTABLE)) {
549 if (GC_IS_RECURSIVE(Z_ARRVAL_P(expr))) {
550 smart_str_appends(buf, " *RECURSION*");
551 return;
552 }
554 }
555 print_hash(buf, Z_ARRVAL_P(expr), indent, 0);
557 break;
558 case IS_OBJECT:
559 {
560 HashTable *properties;
561
562 zend_object *zobj = Z_OBJ_P(expr);
563 uint32_t *guard = zend_get_recursion_guard(zobj);
564 zend_string *class_name = Z_OBJ_HANDLER_P(expr, get_class_name)(zobj);
565 smart_str_appends(buf, ZSTR_VAL(class_name));
566 zend_string_release_ex(class_name, 0);
567
568 if (!(zobj->ce->ce_flags & ZEND_ACC_ENUM)) {
569 smart_str_appends(buf, " Object\n");
570 } else {
571 smart_str_appends(buf, " Enum");
572 if (zobj->ce->enum_backing_type != IS_UNDEF) {
573 smart_str_appendc(buf, ':');
574 smart_str_appends(buf, zend_get_type_by_const(zobj->ce->enum_backing_type));
575 }
576 smart_str_appendc(buf, '\n');
577 }
578
579 if (ZEND_GUARD_OR_GC_IS_RECURSIVE(guard, DEBUG, zobj)) {
580 smart_str_appends(buf, " *RECURSION*");
581 return;
582 }
583
584 if ((properties = zend_get_properties_for(expr, ZEND_PROP_PURPOSE_DEBUG)) == NULL) {
585 print_hash(buf, (HashTable*) &zend_empty_array, indent, 1);
586 break;
587 }
588
590 print_hash(buf, properties, indent, 1);
592
593 zend_release_properties(properties);
594 break;
595 }
596 case IS_LONG:
597 smart_str_append_long(buf, Z_LVAL_P(expr));
598 break;
599 case IS_REFERENCE:
600 zend_print_zval_r_to_buf(buf, Z_REFVAL_P(expr), indent);
601 break;
602 case IS_STRING:
603 smart_str_append(buf, Z_STR_P(expr));
604 break;
605 default:
606 {
608 smart_str_append(buf, str);
610 }
611 break;
612 }
613}
614/* }}} */
615
617{
618 smart_str buf = {0};
619 zend_print_zval_r_to_buf(&buf, expr, indent);
620 smart_str_0(&buf);
621 return buf.s;
622}
623/* }}} */
624
625ZEND_API void zend_print_zval_r(zval *expr, int indent) /* {{{ */
626{
627 zend_string *str = zend_print_zval_r_to_str(expr, indent);
628 zend_write(ZSTR_VAL(str), ZSTR_LEN(str));
630}
631/* }}} */
632
633static FILE *zend_fopen_wrapper(zend_string *filename, zend_string **opened_path) /* {{{ */
634{
635 if (opened_path) {
636 *opened_path = zend_string_copy(filename);
637 }
638 return fopen(ZSTR_VAL(filename), "rb");
639}
640/* }}} */
641
642#ifdef ZTS
643static bool short_tags_default = 1;
645#else
646# define short_tags_default 1
647# define compiler_options_default ZEND_COMPILE_DEFAULT
648#endif
649
650static void zend_set_default_compile_time_values(void) /* {{{ */
651{
652 /* default compile-time values */
653 CG(short_tags) = short_tags_default;
654 CG(compiler_options) = compiler_options_default;
655
656 CG(rtd_key_counter) = 0;
657}
658/* }}} */
659
660#ifdef ZEND_WIN32
661static void zend_get_windows_version_info(OSVERSIONINFOEX *osvi) /* {{{ */
662{
663 ZeroMemory(osvi, sizeof(OSVERSIONINFOEX));
664 osvi->dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
665 if(!GetVersionEx((OSVERSIONINFO *) osvi)) {
666 ZEND_UNREACHABLE(); /* Should not happen as sizeof is used. */
667 }
668}
669/* }}} */
670#endif
671
672static void zend_init_exception_op(void) /* {{{ */
673{
674 memset(EG(exception_op), 0, sizeof(EG(exception_op)));
675 EG(exception_op)[0].opcode = ZEND_HANDLE_EXCEPTION;
676 ZEND_VM_SET_OPCODE_HANDLER(EG(exception_op));
677 EG(exception_op)[1].opcode = ZEND_HANDLE_EXCEPTION;
678 ZEND_VM_SET_OPCODE_HANDLER(EG(exception_op)+1);
679 EG(exception_op)[2].opcode = ZEND_HANDLE_EXCEPTION;
680 ZEND_VM_SET_OPCODE_HANDLER(EG(exception_op)+2);
681}
682/* }}} */
683
684static void zend_init_call_trampoline_op(void) /* {{{ */
685{
686 memset(&EG(call_trampoline_op), 0, sizeof(EG(call_trampoline_op)));
687 EG(call_trampoline_op).opcode = ZEND_CALL_TRAMPOLINE;
688 ZEND_VM_SET_OPCODE_HANDLER(&EG(call_trampoline_op));
689}
690/* }}} */
691
692static void auto_global_dtor(zval *zv) /* {{{ */
693{
694 free(Z_PTR_P(zv));
695}
696/* }}} */
697
698#ifdef ZTS
699static void auto_global_copy_ctor(zval *zv) /* {{{ */
700{
702 zend_auto_global *new_ag = pemalloc(sizeof(zend_auto_global), 1);
703
704 new_ag->name = old_ag->name;
706 new_ag->jit = old_ag->jit;
707
708 Z_PTR_P(zv) = new_ag;
709}
710/* }}} */
711
712static void compiler_globals_ctor(zend_compiler_globals *compiler_globals) /* {{{ */
713{
714 compiler_globals->compiled_filename = NULL;
715 compiler_globals->zend_lineno = 0;
716
717 compiler_globals->function_table = (HashTable *) malloc(sizeof(HashTable));
718 zend_hash_init(compiler_globals->function_table, 1024, NULL, ZEND_FUNCTION_DTOR, 1);
719 zend_hash_copy(compiler_globals->function_table, global_function_table, NULL);
720 compiler_globals->copied_functions_count = zend_hash_num_elements(compiler_globals->function_table);
721
722 compiler_globals->class_table = (HashTable *) malloc(sizeof(HashTable));
724 zend_hash_copy(compiler_globals->class_table, global_class_table, zend_class_add_ref);
725
726 zend_set_default_compile_time_values();
727
728 compiler_globals->auto_globals = (HashTable *) malloc(sizeof(HashTable));
729 zend_hash_init(compiler_globals->auto_globals, 8, NULL, auto_global_dtor, 1);
730 zend_hash_copy(compiler_globals->auto_globals, global_auto_globals_table, auto_global_copy_ctor);
731
732 compiler_globals->script_encoding_list = NULL;
733 compiler_globals->current_linking_class = NULL;
734
735 /* Map region is going to be created and resized at run-time. */
736 compiler_globals->map_ptr_real_base = NULL;
738 compiler_globals->map_ptr_size = 0;
739 compiler_globals->map_ptr_last = global_map_ptr_last;
740 compiler_globals->internal_run_time_cache = NULL;
741 if (compiler_globals->map_ptr_last || zend_map_ptr_static_size) {
742 /* Allocate map_ptr table */
743 compiler_globals->map_ptr_size = ZEND_MM_ALIGNED_SIZE_EX(compiler_globals->map_ptr_last, 4096);
744 void *base = pemalloc((zend_map_ptr_static_size + compiler_globals->map_ptr_size) * sizeof(void*), 1);
745 compiler_globals->map_ptr_real_base = base;
746 compiler_globals->map_ptr_base = ZEND_MAP_PTR_BIASED_BASE(base);
747 memset(base, 0, (zend_map_ptr_static_size + compiler_globals->map_ptr_last) * sizeof(void*));
748 }
750}
751/* }}} */
752
753static void compiler_globals_dtor(zend_compiler_globals *compiler_globals) /* {{{ */
754{
755 if (compiler_globals->function_table != GLOBAL_FUNCTION_TABLE) {
756 uint32_t n = compiler_globals->copied_functions_count;
757
758 /* Prevent destruction of functions copied from the main process context */
759 if (zend_hash_num_elements(compiler_globals->function_table) <= n) {
760 compiler_globals->function_table->nNumUsed = 0;
761 } else {
762 Bucket *p = compiler_globals->function_table->arData;
763
764 compiler_globals->function_table->nNumOfElements -= n;
765 while (n != 0) {
766 ZVAL_UNDEF(&p->val);
767 p++;
768 n--;
769 }
770 }
771 zend_hash_destroy(compiler_globals->function_table);
772 free(compiler_globals->function_table);
773 }
774 if (compiler_globals->class_table != GLOBAL_CLASS_TABLE) {
775 /* Child classes may reuse structures from parent classes, so destroy in reverse order. */
777 free(compiler_globals->class_table);
778 }
779 if (compiler_globals->auto_globals != GLOBAL_AUTO_GLOBALS_TABLE) {
780 zend_hash_destroy(compiler_globals->auto_globals);
781 free(compiler_globals->auto_globals);
782 }
783 if (compiler_globals->script_encoding_list) {
784 pefree((char*)compiler_globals->script_encoding_list, 1);
785 }
786 if (compiler_globals->map_ptr_real_base) {
787 free(compiler_globals->map_ptr_real_base);
788 compiler_globals->map_ptr_real_base = NULL;
790 compiler_globals->map_ptr_size = 0;
791 }
792 if (compiler_globals->internal_run_time_cache) {
793 pefree(compiler_globals->internal_run_time_cache, 1);
794 compiler_globals->internal_run_time_cache = NULL;
795 }
796}
797/* }}} */
798
799static void executor_globals_ctor(zend_executor_globals *executor_globals) /* {{{ */
800{
802 zend_copy_constants(executor_globals->zend_constants, GLOBAL_CONSTANTS_TABLE);
804 zend_init_exception_op();
805 zend_init_call_trampoline_op();
806 memset(&executor_globals->trampoline, 0, sizeof(zend_op_array));
807 executor_globals->capture_warnings_during_sccp = 0;
808 executor_globals->user_error_handler_error_reporting = 0;
809 ZVAL_UNDEF(&executor_globals->user_error_handler);
810 ZVAL_UNDEF(&executor_globals->user_exception_handler);
811 executor_globals->in_autoload = NULL;
812 executor_globals->current_execute_data = NULL;
813 executor_globals->current_module = NULL;
814 executor_globals->exit_status = 0;
815#if XPFPA_HAVE_CW
816 executor_globals->saved_fpu_cw = 0;
817#endif
818 executor_globals->saved_fpu_cw_ptr = NULL;
819 executor_globals->active = 0;
820 executor_globals->bailout = NULL;
821 executor_globals->error_handling = EH_NORMAL;
822 executor_globals->exception_class = NULL;
823 executor_globals->exception = NULL;
824 executor_globals->objects_store.object_buckets = NULL;
825 executor_globals->current_fiber_context = NULL;
826 executor_globals->main_fiber_context = NULL;
827 executor_globals->active_fiber = NULL;
828#ifdef ZEND_WIN32
829 zend_get_windows_version_info(&executor_globals->windows_version_info);
830#endif
832 executor_globals->record_errors = false;
833 executor_globals->num_errors = 0;
834 executor_globals->errors = NULL;
835 executor_globals->filename_override = NULL;
836 executor_globals->lineno_override = -1;
837#ifdef ZEND_CHECK_STACK_LIMIT
838 executor_globals->stack_limit = (void*)0;
839 executor_globals->stack_base = (void*)0;
840#endif
841#ifdef ZEND_MAX_EXECUTION_TIMERS
842 executor_globals->pid = 0;
843 executor_globals->oldact = (struct sigaction){0};
844#endif
845 memset(executor_globals->strtod_state.freelist, 0,
846 sizeof(executor_globals->strtod_state.freelist));
847 executor_globals->strtod_state.p5s = NULL;
848 executor_globals->strtod_state.result = NULL;
849}
850/* }}} */
851
852static void executor_globals_persistent_list_dtor(void *storage)
853{
855
856 if (&executor_globals->persistent_list != global_persistent_list) {
857 zend_destroy_rsrc_list(&executor_globals->persistent_list);
858 }
859}
860
861static void executor_globals_dtor(zend_executor_globals *executor_globals) /* {{{ */
862{
863 zend_ini_dtor(executor_globals->ini_directives);
864
865 if (executor_globals->zend_constants != GLOBAL_CONSTANTS_TABLE) {
866 zend_hash_destroy(executor_globals->zend_constants);
867 free(executor_globals->zend_constants);
868 }
869}
870/* }}} */
871
872static void zend_new_thread_end_handler(THREAD_T thread_id) /* {{{ */
873{
876#ifdef ZEND_CHECK_STACK_LIMIT
877 zend_call_stack_init();
878#endif
880}
881/* }}} */
882#endif
883
884#if defined(__FreeBSD__) || defined(__DragonFly__)
885/* FreeBSD and DragonFly floating point precision fix */
886#include <floatingpoint.h>
887#endif
888
889static void ini_scanner_globals_ctor(zend_ini_scanner_globals *scanner_globals_p) /* {{{ */
890{
891 memset(scanner_globals_p, 0, sizeof(*scanner_globals_p));
892}
893/* }}} */
894
895static void php_scanner_globals_ctor(zend_php_scanner_globals *scanner_globals_p) /* {{{ */
896{
897 memset(scanner_globals_p, 0, sizeof(*scanner_globals_p));
898}
899/* }}} */
900
901static void module_destructor_zval(zval *zv) /* {{{ */
902{
904 module_destructor(module);
905}
906/* }}} */
907
908static bool php_auto_globals_create_globals(zend_string *name) /* {{{ */
909{
910 /* While we keep registering $GLOBALS as an auto-global, we do not create an
911 * actual variable for it. Access to it handled specially by the compiler. */
912 return 0;
913}
914/* }}} */
915
916void zend_startup(zend_utility_functions *utility_functions) /* {{{ */
917{
918#ifdef ZTS
921 extern ZEND_API ts_rsrc_id ini_scanner_globals_id;
922 extern ZEND_API ts_rsrc_id language_scanner_globals_id;
923#else
926#endif
927
929
930#ifdef ZEND_WIN32
932#endif
933
934 /* Set up early utility functions. zend_mm depends on
935 * zend_random_bytes_insecure */
936 zend_random_bytes = utility_functions->random_bytes_function;
938
940
941 virtual_cwd_startup(); /* Could use shutdown to free the main cwd but it would just slow it down for CGI */
942
943#if defined(__FreeBSD__) || defined(__DragonFly__)
944 /* FreeBSD and DragonFly floating point precision fix */
945 fpsetmask(0);
946#endif
947
950
951 /* Set up utility functions and values */
952 zend_error_cb = utility_functions->error_function;
953 zend_printf = utility_functions->printf_function;
954 zend_write = utility_functions->write_function;
955 zend_fopen = utility_functions->fopen_function;
956 if (!zend_fopen) {
957 zend_fopen = zend_fopen_wrapper;
958 }
960 zend_message_dispatcher_p = utility_functions->message_handler;
961 zend_get_configuration_directive_p = utility_functions->get_configuration_directive;
962 zend_ticks_function = utility_functions->ticks_function;
963 zend_on_timeout = utility_functions->on_timeout;
966 zend_getenv = utility_functions->getenv_function;
967 zend_resolve_path = utility_functions->resolve_path_function;
968
970
971#ifdef HAVE_DTRACE
972/* build with dtrace support */
973 {
974 char *tmp = getenv("USE_ZEND_DTRACE");
975
976 if (tmp && ZEND_ATOL(tmp)) {
978 zend_compile_file = dtrace_compile_file;
979 zend_execute_ex = dtrace_execute_ex;
980 zend_execute_internal = dtrace_execute_internal;
981
982 zend_observer_error_register(dtrace_error_notify_cb);
983 } else {
987 }
988 }
989#else
993#endif /* HAVE_DTRACE */
996
997 /* Set up the default garbage collection implementation. */
999
1000 zend_vm_init();
1001
1002 /* set up version */
1003 zend_version_info = strdup(ZEND_CORE_VERSION_INFO);
1004 zend_version_info_length = sizeof(ZEND_CORE_VERSION_INFO) - 1;
1005
1006 GLOBAL_FUNCTION_TABLE = (HashTable *) malloc(sizeof(HashTable));
1007 GLOBAL_CLASS_TABLE = (HashTable *) malloc(sizeof(HashTable));
1008 GLOBAL_AUTO_GLOBALS_TABLE = (HashTable *) malloc(sizeof(HashTable));
1009 GLOBAL_CONSTANTS_TABLE = (HashTable *) malloc(sizeof(HashTable));
1010
1013 zend_hash_init(GLOBAL_AUTO_GLOBALS_TABLE, 8, NULL, auto_global_dtor, 1);
1015
1016 zend_hash_init(&module_registry, 32, NULL, module_destructor_zval, 1);
1018
1019#ifdef ZTS
1020 ts_allocate_fast_id(&compiler_globals_id, &compiler_globals_offset, sizeof(zend_compiler_globals), (ts_allocate_ctor) compiler_globals_ctor, (ts_allocate_dtor) compiler_globals_dtor);
1021 ts_allocate_fast_id(&executor_globals_id, &executor_globals_offset, sizeof(zend_executor_globals), (ts_allocate_ctor) executor_globals_ctor, (ts_allocate_dtor) executor_globals_dtor);
1022 ts_allocate_fast_id(&language_scanner_globals_id, &language_scanner_globals_offset, sizeof(zend_php_scanner_globals), (ts_allocate_ctor) php_scanner_globals_ctor, NULL);
1023 ts_allocate_fast_id(&ini_scanner_globals_id, &ini_scanner_globals_offset, sizeof(zend_ini_scanner_globals), (ts_allocate_ctor) ini_scanner_globals_ctor, NULL);
1024 compiler_globals = ts_resource(compiler_globals_id);
1025 executor_globals = ts_resource(executor_globals_id);
1026
1027 compiler_globals_dtor(compiler_globals);
1028 compiler_globals->in_compilation = 0;
1029 compiler_globals->function_table = (HashTable *) malloc(sizeof(HashTable));
1030 compiler_globals->class_table = (HashTable *) malloc(sizeof(HashTable));
1031
1032 *compiler_globals->function_table = *GLOBAL_FUNCTION_TABLE;
1033 *compiler_globals->class_table = *GLOBAL_CLASS_TABLE;
1035
1036 zend_hash_destroy(executor_globals->zend_constants);
1037 *executor_globals->zend_constants = *GLOBAL_CONSTANTS_TABLE;
1038#else
1039 ini_scanner_globals_ctor(&ini_scanner_globals);
1040 php_scanner_globals_ctor(&language_scanner_globals);
1041 zend_set_default_compile_time_values();
1042#ifdef ZEND_WIN32
1043 zend_get_windows_version_info(&EG(windows_version_info));
1044#endif
1045 /* Map region is going to be created and resized at run-time. */
1046 CG(map_ptr_real_base) = NULL;
1047 CG(map_ptr_base) = ZEND_MAP_PTR_BIASED_BASE(NULL);
1048 CG(map_ptr_size) = 0;
1049 CG(map_ptr_last) = 0;
1050#endif /* ZTS */
1052
1056 zend_register_auto_global(zend_string_init_interned("GLOBALS", sizeof("GLOBALS") - 1, 1), 1, php_auto_globals_create_globals);
1057
1058#ifndef ZTS
1060 zend_init_exception_op();
1061 zend_init_call_trampoline_op();
1062#endif
1063
1065
1066#ifdef ZEND_WIN32
1067 /* Uses INI settings, so needs to be run after it. */
1069#endif
1070
1072
1073#ifdef ZTS
1074 tsrm_set_new_thread_end_handler(zend_new_thread_end_handler);
1075 tsrm_set_shutdown_handler(zend_interned_strings_dtor);
1076#endif
1077}
1078/* }}} */
1079
1081{
1083}
1084/* }}} */
1085
1086
1087/* Unlink the global (r/o) copies of the class, function and constant tables,
1088 * and use a fresh r/w copy for the startup thread
1089 */
1091{
1092#ifdef ZTS
1093 zend_encoding **script_encoding_list;
1094
1095 zend_compiler_globals *compiler_globals = ts_resource(compiler_globals_id);
1096 zend_executor_globals *executor_globals = ts_resource(executor_globals_id);
1097#endif
1098
1099 startup_done = true;
1100
1103
1105 if (cb() != SUCCESS) {
1106 return FAILURE;
1107 }
1108 }
1109
1110#ifdef ZTS
1111 *GLOBAL_FUNCTION_TABLE = *compiler_globals->function_table;
1112 *GLOBAL_CLASS_TABLE = *compiler_globals->class_table;
1113 *GLOBAL_CONSTANTS_TABLE = *executor_globals->zend_constants;
1114 global_map_ptr_last = compiler_globals->map_ptr_last;
1115
1116 short_tags_default = CG(short_tags);
1117 compiler_options_default = CG(compiler_options);
1118
1119 zend_destroy_rsrc_list(&EG(persistent_list));
1120 free(compiler_globals->function_table);
1121 compiler_globals->function_table = NULL;
1122 free(compiler_globals->class_table);
1123 compiler_globals->class_table = NULL;
1124 if (compiler_globals->map_ptr_real_base) {
1125 free(compiler_globals->map_ptr_real_base);
1126 }
1127 compiler_globals->map_ptr_real_base = NULL;
1129 if (compiler_globals->internal_run_time_cache) {
1130 pefree(compiler_globals->internal_run_time_cache, 1);
1131 }
1132 compiler_globals->internal_run_time_cache = NULL;
1133 if ((script_encoding_list = (zend_encoding **)compiler_globals->script_encoding_list)) {
1134 compiler_globals_ctor(compiler_globals);
1135 compiler_globals->script_encoding_list = (const zend_encoding **)script_encoding_list;
1136 } else {
1137 compiler_globals_ctor(compiler_globals);
1138 }
1139 free(EG(zend_constants));
1140 EG(zend_constants) = NULL;
1141
1142 executor_globals_ctor(executor_globals);
1143 global_persistent_list = &EG(persistent_list);
1145#else
1146 global_map_ptr_last = CG(map_ptr_last);
1147#endif
1148
1149#ifdef ZEND_CHECK_STACK_LIMIT
1150 zend_call_stack_init();
1151#endif
1152 gc_init();
1153
1154 return SUCCESS;
1155}
1156/* }}} */
1157
1158void zend_shutdown(void) /* {{{ */
1159{
1160 zend_vm_dtor();
1161
1162 zend_destroy_rsrc_list(&EG(persistent_list));
1163#ifdef ZTS
1164 ts_apply_for_id(executor_globals_id, executor_globals_persistent_list_dtor);
1165#endif
1167
1170
1172 /* Child classes may reuse structures from parent classes, so destroy in reverse order. */
1174
1176 zend_flf_count = 0;
1177 free(zend_flf_functions);
1178 free(zend_flf_handlers);
1181
1184
1186 free(zend_version_info);
1187
1189 free(GLOBAL_CLASS_TABLE);
1190
1195
1196#ifdef ZTS
1201 ts_free_id(executor_globals_id);
1202 ts_free_id(compiler_globals_id);
1203#else
1204 if (CG(map_ptr_real_base)) {
1205 free(CG(map_ptr_real_base));
1206 CG(map_ptr_real_base) = NULL;
1207 CG(map_ptr_base) = ZEND_MAP_PTR_BIASED_BASE(NULL);
1208 CG(map_ptr_size) = 0;
1209 }
1210 if (CG(script_encoding_list)) {
1211 free(ZEND_VOIDP(CG(script_encoding_list)));
1212 CG(script_encoding_list) = NULL;
1213 CG(script_encoding_list_size) = 0;
1214 }
1215 if (CG(internal_run_time_cache)) {
1216 pefree(CG(internal_run_time_cache), 1);
1217 CG(internal_run_time_cache) = NULL;
1218 }
1219#endif
1222
1224
1226
1228 startup_done = false;
1229}
1230/* }}} */
1231
1232void zend_set_utility_values(zend_utility_values *utility_values) /* {{{ */
1233{
1234 zend_uv = *utility_values;
1235}
1236/* }}} */
1237
1238/* this should be compatible with the standard zenderror */
1239ZEND_COLD void zenderror(const char *error) /* {{{ */
1240{
1241 CG(parse_error) = 0;
1242
1243 if (EG(exception)) {
1244 /* An exception was thrown in the lexer, don't throw another in the parser. */
1245 return;
1246 }
1247
1249}
1250/* }}} */
1251
1252ZEND_API ZEND_COLD ZEND_NORETURN void _zend_bailout(const char *filename, uint32_t lineno) /* {{{ */
1253{
1254
1255 if (!EG(bailout)) {
1256 zend_output_debug_string(1, "%s(%d) : Bailed out without a bailout address!", filename, lineno);
1257 exit(-1);
1258 }
1259 gc_protect(1);
1260 CG(unclean_shutdown) = 1;
1261 CG(active_class_entry) = NULL;
1262 CG(in_compilation) = 0;
1263 CG(memoize_mode) = 0;
1264 EG(current_execute_data) = NULL;
1266}
1267/* }}} */
1268
1270{
1271#ifdef _WIN32
1272 SYSTEM_INFO system_info;
1273 GetSystemInfo(&system_info);
1274 return system_info.dwPageSize;
1275#elif defined(__FreeBSD__)
1276 /* This returns the value obtained from
1277 * the auxv vector, avoiding a syscall. */
1278 return getpagesize();
1279#else
1280 return (size_t) sysconf(_SC_PAGESIZE);
1281#endif
1282}
1283
1284ZEND_API void zend_append_version_info(const zend_extension *extension) /* {{{ */
1285{
1286 char *new_info;
1287 uint32_t new_info_length;
1288
1289 new_info_length = (uint32_t)(sizeof(" with v, , by \n")
1290 + strlen(extension->name)
1291 + strlen(extension->version)
1292 + strlen(extension->copyright)
1293 + strlen(extension->author));
1294
1295 new_info = (char *) malloc(new_info_length + 1);
1296
1297 snprintf(new_info, new_info_length, " with %s v%s, %s, by %s\n", extension->name, extension->version, extension->copyright, extension->author);
1298
1299 zend_version_info = (char *) realloc(zend_version_info, zend_version_info_length+new_info_length + 1);
1300 strncat(zend_version_info, new_info, new_info_length);
1301 zend_version_info_length += new_info_length;
1302 free(new_info);
1303}
1304/* }}} */
1305
1306ZEND_API const char *get_zend_version(void) /* {{{ */
1307{
1308 return zend_version_info;
1309}
1310/* }}} */
1311
1312ZEND_API void zend_activate(void) /* {{{ */
1313{
1314#ifdef ZTS
1316#endif
1317 gc_reset();
1318 init_compiler();
1319 init_executor();
1321 if (CG(map_ptr_last)) {
1322 memset((void **)CG(map_ptr_real_base) + zend_map_ptr_static_size, 0, CG(map_ptr_last) * sizeof(void*));
1323 }
1326}
1327/* }}} */
1328
1329void zend_call_destructors(void) /* {{{ */
1330{
1331 zend_try {
1333 } zend_end_try();
1334}
1335/* }}} */
1336
1337ZEND_API void zend_deactivate(void) /* {{{ */
1338{
1339 /* we're no longer executing anything */
1340 EG(current_execute_data) = NULL;
1341
1342 zend_try {
1344 } zend_end_try();
1345
1346 /* shutdown_executor() takes care of its own bailout handling */
1348
1349 zend_try {
1351 } zend_end_try();
1352
1353 zend_try {
1355 } zend_end_try();
1356
1357 zend_destroy_rsrc_list(&EG(regular_list));
1358
1359 /* See GH-8646: https://github.com/php/php-src/issues/8646
1360 *
1361 * Interned strings that hold class entries can get a corresponding slot in map_ptr for the CE cache.
1362 * map_ptr works like a bump allocator: there is a counter which increases to allocate the next slot in the map.
1363 *
1364 * For class name strings in non-opcache we have:
1365 * - on startup: permanent + interned
1366 * - on request: interned
1367 * For class name strings in opcache we have:
1368 * - on startup: permanent + interned
1369 * - on request: either not interned at all, which we can ignore because they won't get a CE cache entry
1370 * or they were already permanent + interned
1371 * or we get a new permanent + interned string in the opcache persistence code
1372 *
1373 * Notice that the map_ptr layout always has the permanent strings first, and the request strings after.
1374 * In non-opcache, a request string may get a slot in map_ptr, and that interned request string
1375 * gets destroyed at the end of the request. The corresponding map_ptr slot can thereafter never be used again.
1376 * This causes map_ptr to keep reallocating to larger and larger sizes.
1377 *
1378 * We solve it as follows:
1379 * We can check whether we had any interned request strings, which only happens in non-opcache.
1380 * If we have any, we reset map_ptr to the last permanent string.
1381 * We can't lose any permanent strings because of map_ptr's layout.
1382 */
1383 if (zend_hash_num_elements(&CG(interned_strings)) > 0) {
1385 }
1386
1387#if GC_BENCH
1388 gc_bench_print();
1389#endif
1390}
1391/* }}} */
1392
1393ZEND_API void zend_message_dispatcher(zend_long message, const void *data) /* {{{ */
1394{
1395 if (zend_message_dispatcher_p) {
1396 zend_message_dispatcher_p(message, data);
1397 }
1398}
1399/* }}} */
1400
1402{
1403 if (zend_get_configuration_directive_p) {
1404 return zend_get_configuration_directive_p(name);
1405 } else {
1406 return NULL;
1407 }
1408}
1409/* }}} */
1410
1411#define SAVE_STACK(stack) do { \
1412 if (CG(stack).top) { \
1413 memcpy(&stack, &CG(stack), sizeof(zend_stack)); \
1414 CG(stack).top = CG(stack).max = 0; \
1415 CG(stack).elements = NULL; \
1416 } else { \
1417 stack.top = 0; \
1418 } \
1419 } while (0)
1420
1421#define RESTORE_STACK(stack) do { \
1422 if (stack.top) { \
1423 zend_stack_destroy(&CG(stack)); \
1424 memcpy(&CG(stack), &stack, sizeof(zend_stack)); \
1425 } \
1426 } while (0)
1427
1429 int orig_type, zend_string *error_filename, uint32_t error_lineno, zend_string *message)
1430{
1431 zval params[4];
1432 zval retval;
1433 zval orig_user_error_handler;
1434 bool in_compilation;
1435 zend_class_entry *saved_class_entry = NULL;
1436 zend_stack loop_var_stack;
1437 zend_stack delayed_oplines_stack;
1438 int type = orig_type & E_ALL;
1439 bool orig_record_errors;
1440 uint32_t orig_num_errors;
1441 zend_error_info **orig_errors;
1443
1444 /* If we're executing a function during SCCP, count any warnings that may be emitted,
1445 * but don't perform any other error handling. */
1446 if (EG(capture_warnings_during_sccp)) {
1447 ZEND_ASSERT(!(type & E_FATAL_ERRORS) && "Fatal error during SCCP");
1448 EG(capture_warnings_during_sccp)++;
1449 return;
1450 }
1451
1452 if (EG(record_errors)) {
1453 zend_error_info *info = emalloc(sizeof(zend_error_info));
1454 info->type = type;
1455 info->lineno = error_lineno;
1456 info->filename = zend_string_copy(error_filename);
1457 info->message = zend_string_copy(message);
1458
1459 /* This is very inefficient for a large number of errors.
1460 * Use pow2 realloc if it becomes a problem. */
1461 EG(num_errors)++;
1462 EG(errors) = erealloc(EG(errors), sizeof(zend_error_info*) * EG(num_errors));
1463 EG(errors)[EG(num_errors)-1] = info;
1464 }
1465
1466 /* Report about uncaught exception in case of fatal errors */
1467 if (EG(exception)) {
1469 const zend_op *opline;
1470
1471 if (type & E_FATAL_ERRORS) {
1472 ex = EG(current_execute_data);
1473 opline = NULL;
1474 while (ex && (!ex->func || !ZEND_USER_CODE(ex->func->type))) {
1475 ex = ex->prev_execute_data;
1476 }
1477 if (ex && ex->opline->opcode == ZEND_HANDLE_EXCEPTION &&
1478 EG(opline_before_exception)) {
1479 opline = EG(opline_before_exception);
1480 }
1482 EG(exception) = NULL;
1483 if (opline) {
1484 ex->opline = opline;
1485 }
1486 }
1487 }
1488
1489 zend_observer_error_notify(type, error_filename, error_lineno, message);
1490
1491 /* if we don't have a user defined error handler */
1492 if (Z_TYPE(EG(user_error_handler)) == IS_UNDEF
1493 || !(EG(user_error_handler_error_reporting) & type)
1494 || EG(error_handling) != EH_NORMAL) {
1495 zend_error_cb(orig_type, error_filename, error_lineno, message);
1496 } else switch (type) {
1497 case E_ERROR:
1498 case E_PARSE:
1499 case E_CORE_ERROR:
1500 case E_CORE_WARNING:
1501 case E_COMPILE_ERROR:
1502 case E_COMPILE_WARNING:
1503 /* The error may not be safe to handle in user-space */
1504 zend_error_cb(orig_type, error_filename, error_lineno, message);
1505 break;
1506 default:
1507 /* Handle the error in user space */
1508 ZVAL_STR_COPY(&params[1], message);
1509 ZVAL_LONG(&params[0], type);
1510
1511 if (error_filename) {
1512 ZVAL_STR_COPY(&params[2], error_filename);
1513 } else {
1514 ZVAL_NULL(&params[2]);
1515 }
1516
1517 ZVAL_LONG(&params[3], error_lineno);
1518
1519 ZVAL_COPY_VALUE(&orig_user_error_handler, &EG(user_error_handler));
1520 ZVAL_UNDEF(&EG(user_error_handler));
1521
1522 /* User error handler may include() additional PHP files.
1523 * If an error was generated during compilation PHP will compile
1524 * such scripts recursively, but some CG() variables may be
1525 * inconsistent. */
1526
1527 in_compilation = CG(in_compilation);
1528 if (in_compilation) {
1529 saved_class_entry = CG(active_class_entry);
1530 CG(active_class_entry) = NULL;
1531 SAVE_STACK(loop_var_stack);
1532 SAVE_STACK(delayed_oplines_stack);
1533 CG(in_compilation) = 0;
1534 }
1535
1536 orig_record_errors = EG(record_errors);
1537 orig_num_errors = EG(num_errors);
1538 orig_errors = EG(errors);
1539 EG(record_errors) = false;
1540 EG(num_errors) = 0;
1541 EG(errors) = NULL;
1542
1543 res = call_user_function(CG(function_table), NULL, &orig_user_error_handler, &retval, 4, params);
1544
1545 EG(record_errors) = orig_record_errors;
1546 EG(num_errors) = orig_num_errors;
1547 EG(errors) = orig_errors;
1548
1549 if (res == SUCCESS) {
1550 if (Z_TYPE(retval) != IS_UNDEF) {
1551 if (Z_TYPE(retval) == IS_FALSE) {
1552 zend_error_cb(orig_type, error_filename, error_lineno, message);
1553 }
1555 }
1556 } else if (!EG(exception)) {
1557 /* The user error handler failed, use built-in error handler */
1558 zend_error_cb(orig_type, error_filename, error_lineno, message);
1559 }
1560
1561 if (in_compilation) {
1562 CG(active_class_entry) = saved_class_entry;
1563 RESTORE_STACK(loop_var_stack);
1564 RESTORE_STACK(delayed_oplines_stack);
1565 CG(in_compilation) = 1;
1566 }
1567
1568 zval_ptr_dtor(&params[2]);
1569 zval_ptr_dtor(&params[1]);
1570
1571 if (Z_TYPE(EG(user_error_handler)) == IS_UNDEF) {
1572 ZVAL_COPY_VALUE(&EG(user_error_handler), &orig_user_error_handler);
1573 } else {
1574 zval_ptr_dtor(&orig_user_error_handler);
1575 }
1576 break;
1577 }
1578
1579 if (type == E_PARSE) {
1580 /* eval() errors do not affect exit_status */
1581 if (!(EG(current_execute_data) &&
1582 EG(current_execute_data)->func &&
1583 ZEND_USER_CODE(EG(current_execute_data)->func->type) &&
1584 EG(current_execute_data)->opline->opcode == ZEND_INCLUDE_OR_EVAL &&
1585 EG(current_execute_data)->opline->extended_value == ZEND_EVAL)) {
1586 EG(exit_status) = 255;
1587 }
1588 }
1589}
1590/* }}} */
1591
1592static ZEND_COLD void zend_error_va_list(
1593 int orig_type, zend_string *error_filename, uint32_t error_lineno,
1594 const char *format, va_list args)
1595{
1596 zend_string *message = zend_vstrpprintf(0, format, args);
1597 zend_error_zstr_at(orig_type, error_filename, error_lineno, message);
1598 zend_string_release(message);
1599}
1600
1601static ZEND_COLD void get_filename_lineno(int type, zend_string **filename, uint32_t *lineno) {
1602 /* Obtain relevant filename and lineno */
1603 switch (type) {
1604 case E_CORE_ERROR:
1605 case E_CORE_WARNING:
1606 *filename = NULL;
1607 *lineno = 0;
1608 break;
1609 case E_PARSE:
1610 case E_COMPILE_ERROR:
1611 case E_COMPILE_WARNING:
1612 case E_ERROR:
1613 case E_NOTICE:
1614 case E_DEPRECATED:
1615 case E_WARNING:
1616 case E_USER_ERROR:
1617 case E_USER_WARNING:
1618 case E_USER_NOTICE:
1619 case E_USER_DEPRECATED:
1621 if (zend_is_compiling()) {
1622 *filename = zend_get_compiled_filename();
1623 *lineno = zend_get_compiled_lineno();
1624 } else if (zend_is_executing()) {
1625 *filename = zend_get_executed_filename_ex();
1626 *lineno = zend_get_executed_lineno();
1627 } else {
1628 *filename = NULL;
1629 *lineno = 0;
1630 }
1631 break;
1632 default:
1633 *filename = NULL;
1634 *lineno = 0;
1635 break;
1636 }
1637 if (!*filename) {
1638 *filename = ZSTR_KNOWN(ZEND_STR_UNKNOWN_CAPITALIZED);
1639 }
1640}
1641
1643 int type, zend_string *filename, uint32_t lineno, const char *format, ...) {
1644 va_list args;
1645
1646 if (!filename) {
1647 uint32_t dummy_lineno;
1648 get_filename_lineno(type, &filename, &dummy_lineno);
1649 }
1650
1651 va_start(args, format);
1652 zend_error_va_list(type, filename, lineno, format, args);
1653 va_end(args);
1654}
1655
1656#define zend_error_impl(type, format) do { \
1657 zend_string *filename; \
1658 uint32_t lineno; \
1659 va_list args; \
1660 get_filename_lineno(type, &filename, &lineno); \
1661 va_start(args, format); \
1662 zend_error_va_list(type, filename, lineno, format, args); \
1663 va_end(args); \
1664 } while (0)
1665
1666ZEND_API ZEND_COLD void zend_error(int type, const char *format, ...) {
1667 zend_error_impl(type, format);
1668}
1669
1670ZEND_API ZEND_COLD void zend_error_unchecked(int type, const char *format, ...) {
1671 zend_error_impl(type, format);
1672}
1673
1675 int type, zend_string *filename, uint32_t lineno, const char *format, ...)
1676{
1677 va_list args;
1678
1679 if (!filename) {
1680 uint32_t dummy_lineno;
1681 get_filename_lineno(type, &filename, &dummy_lineno);
1682 }
1683
1684 va_start(args, format);
1685 zend_error_va_list(type, filename, lineno, format, args);
1686 va_end(args);
1687 /* Should never reach this. */
1688 abort();
1689}
1690
1691#define zend_error_noreturn_impl(type, format) do { \
1692 zend_string *filename; \
1693 uint32_t lineno; \
1694 va_list args; \
1695 get_filename_lineno(type, &filename, &lineno); \
1696 va_start(args, format); \
1697 zend_error_va_list(type, filename, lineno, format, args); \
1698 va_end(args); \
1699 /* Should never reach this. */ \
1700 abort(); \
1701 } while (0)
1702
1703ZEND_API ZEND_COLD ZEND_NORETURN void zend_error_noreturn(int type, const char *format, ...)
1704{
1706}
1707
1709{
1711}
1712
1713ZEND_API ZEND_COLD ZEND_NORETURN void zend_strerror_noreturn(int type, int errn, const char *message)
1714{
1715#ifdef HAVE_STRERROR_R
1716 char b[1024];
1717
1718# ifdef STRERROR_R_CHAR_P
1719 char *buf = strerror_r(errn, b, sizeof(b));
1720# else
1721 strerror_r(errn, b, sizeof(b));
1722 char *buf = b;
1723# endif
1724#else
1725 char *buf = strerror(errn);
1726#endif
1727
1728 zend_error_noreturn(type, "%s: %s (%d)", message, buf, errn);
1729}
1730
1732 zend_string *filename;
1733 uint32_t lineno;
1734 get_filename_lineno(type, &filename, &lineno);
1735 zend_error_zstr_at(type, filename, lineno, message);
1736}
1737
1739{
1740 ZEND_ASSERT(!EG(record_errors) && "Error recording already enabled");
1741 EG(record_errors) = true;
1742 EG(num_errors) = 0;
1743 EG(errors) = NULL;
1744}
1745
1747{
1748 EG(record_errors) = false;
1749 for (uint32_t i = 0; i < EG(num_errors); i++) {
1750 zend_error_info *error = EG(errors)[i];
1751 zend_error_zstr_at(error->type, error->filename, error->lineno, error->message);
1752 }
1753}
1754
1756{
1757 if (!EG(num_errors)) {
1758 return;
1759 }
1760
1761 for (uint32_t i = 0; i < EG(num_errors); i++) {
1762 zend_error_info *info = EG(errors)[i];
1763 zend_string_release(info->filename);
1764 zend_string_release(info->message);
1765 efree(info);
1766 }
1767 efree(EG(errors));
1768 EG(errors) = NULL;
1769 EG(num_errors) = 0;
1770}
1771
1772ZEND_API ZEND_COLD void zend_throw_error(zend_class_entry *exception_ce, const char *format, ...) /* {{{ */
1773{
1774 va_list va;
1775 char *message = NULL;
1776
1777 if (!exception_ce) {
1778 exception_ce = zend_ce_error;
1779 }
1780
1781 /* Marker used to disable exception generation during preloading. */
1782 if (EG(exception) == (void*)(uintptr_t)-1) {
1783 return;
1784 }
1785
1786 va_start(va, format);
1787 zend_vspprintf(&message, 0, format, va);
1788
1789 //TODO: we can't convert compile-time errors to exceptions yet???
1790 if (EG(current_execute_data) && !CG(in_compilation)) {
1791 zend_throw_exception(exception_ce, message, 0);
1792 } else {
1793 zend_error_noreturn(E_ERROR, "%s", message);
1794 }
1795
1796 efree(message);
1797 va_end(va);
1798}
1799/* }}} */
1800
1801/* type should be one of the BP_VAR_* constants, only special messages happen for isset/empty and unset */
1803{
1804 switch (type) {
1805 case BP_VAR_IS:
1806 zend_type_error("Cannot access offset of type %s in isset or empty",
1808 return;
1809 case BP_VAR_UNSET:
1810 /* Consistent error for when trying to unset a string offset */
1811 if (zend_string_equals(container, ZSTR_KNOWN(ZEND_STR_STRING))) {
1812 zend_throw_error(NULL, "Cannot unset string offsets");
1813 } else {
1814 zend_type_error("Cannot unset offset of type %s on %s", zend_zval_type_name(offset), ZSTR_VAL(container));
1815 }
1816 return;
1817 default:
1818 zend_type_error("Cannot access offset of type %s on %s",
1820 return;
1821 }
1822}
1823
1824ZEND_API ZEND_COLD void zend_type_error(const char *format, ...) /* {{{ */
1825{
1826 va_list va;
1827 char *message = NULL;
1828
1829 va_start(va, format);
1830 zend_vspprintf(&message, 0, format, va);
1832 efree(message);
1833 va_end(va);
1834} /* }}} */
1835
1836ZEND_API ZEND_COLD void zend_argument_count_error(const char *format, ...) /* {{{ */
1837{
1838 va_list va;
1839 char *message = NULL;
1840
1841 va_start(va, format);
1842 zend_vspprintf(&message, 0, format, va);
1844 efree(message);
1845
1846 va_end(va);
1847} /* }}} */
1848
1849ZEND_API ZEND_COLD void zend_value_error(const char *format, ...) /* {{{ */
1850{
1851 va_list va;
1852 char *message = NULL;
1853
1854 va_start(va, format);
1855 zend_vspprintf(&message, 0, format, va);
1857 efree(message);
1858 va_end(va);
1859} /* }}} */
1860
1861ZEND_API ZEND_COLD void zend_output_debug_string(bool trigger_break, const char *format, ...) /* {{{ */
1862{
1863#if ZEND_DEBUG
1864 va_list args;
1865
1866 va_start(args, format);
1867# ifdef ZEND_WIN32
1868 {
1869 char output_buf[1024];
1870
1871 vsnprintf(output_buf, 1024, format, args);
1872 OutputDebugString(output_buf);
1873 OutputDebugString("\n");
1874 if (trigger_break && IsDebuggerPresent()) {
1875 DebugBreak();
1876 }
1877 }
1878# else
1879 vfprintf(stderr, format, args);
1880 fprintf(stderr, "\n");
1881# endif
1882 va_end(args);
1883#endif
1884}
1885/* }}} */
1886
1888{
1889 zval orig_user_exception_handler;
1890 zval params[1], retval2;
1891 zend_object *old_exception;
1892
1894 return;
1895 }
1896
1897 old_exception = EG(exception);
1898 EG(exception) = NULL;
1899 ZVAL_OBJ(&params[0], old_exception);
1900
1901 ZVAL_COPY_VALUE(&orig_user_exception_handler, &EG(user_exception_handler));
1902 zend_stack_push(&EG(user_exception_handlers), &orig_user_exception_handler);
1903 ZVAL_UNDEF(&EG(user_exception_handler));
1904
1905 if (call_user_function(CG(function_table), NULL, &orig_user_exception_handler, &retval2, 1, params) == SUCCESS) {
1906 zval_ptr_dtor(&retval2);
1907 if (EG(exception)) {
1909 EG(exception) = NULL;
1910 }
1911 OBJ_RELEASE(old_exception);
1912 } else {
1913 EG(exception) = old_exception;
1914 }
1915
1916 if (Z_TYPE(EG(user_exception_handler)) == IS_UNDEF) {
1917 zval *tmp = zend_stack_top(&EG(user_exception_handlers));
1918 if (tmp) {
1919 ZVAL_COPY_VALUE(&EG(user_exception_handler), tmp);
1920 zend_stack_del_top(&EG(user_exception_handlers));
1921 }
1922 }
1923} /* }}} */
1924
1926{
1927 zend_op_array *op_array = zend_compile_file(file_handle, type);
1928 if (file_handle->opened_path) {
1929 zend_hash_add_empty_element(&EG(included_files), file_handle->opened_path);
1930 }
1931
1933 if (op_array) {
1934 zend_execute(op_array, retval);
1936 if (UNEXPECTED(EG(exception))) {
1937 if (Z_TYPE(EG(user_exception_handler)) != IS_UNDEF) {
1939 }
1940 if (EG(exception)) {
1942 }
1943 }
1944 zend_destroy_static_vars(op_array);
1945 destroy_op_array(op_array);
1946 efree_size(op_array, sizeof(zend_op_array));
1947 } else if (type == ZEND_REQUIRE) {
1948 ret = FAILURE;
1949 }
1950
1951 return ret;
1952}
1953
1954ZEND_API zend_result zend_execute_scripts(int type, zval *retval, int file_count, ...) /* {{{ */
1955{
1956 va_list files;
1957 int i;
1958 zend_file_handle *file_handle;
1960
1961 va_start(files, file_count);
1962 for (i = 0; i < file_count; i++) {
1963 file_handle = va_arg(files, zend_file_handle *);
1964 if (!file_handle) {
1965 continue;
1966 }
1967 if (ret == FAILURE) {
1968 continue;
1969 }
1970 ret = zend_execute_script(type, retval, file_handle);
1971 }
1972 va_end(files);
1973
1974 return ret;
1975}
1976/* }}} */
1977
1978#define COMPILED_STRING_DESCRIPTION_FORMAT "%s(%d) : %s"
1979
1981{
1982 const char *cur_filename;
1983 int cur_lineno;
1984 char *compiled_string_description;
1985
1986 if (zend_is_compiling()) {
1987 cur_filename = ZSTR_VAL(zend_get_compiled_filename());
1988 cur_lineno = zend_get_compiled_lineno();
1989 } else if (zend_is_executing()) {
1990 cur_filename = zend_get_executed_filename();
1991 cur_lineno = zend_get_executed_lineno();
1992 } else {
1993 cur_filename = "Unknown";
1994 cur_lineno = 0;
1995 }
1996
1997 zend_spprintf(&compiled_string_description, 0, COMPILED_STRING_DESCRIPTION_FORMAT, cur_filename, cur_lineno, name);
1998 return compiled_string_description;
1999}
2000/* }}} */
2001
2002void free_estring(char **str_p) /* {{{ */
2003{
2004 efree(*str_p);
2005}
2006/* }}} */
2007
2010
2012{
2013 CG(map_ptr_last) = global_map_ptr_last;
2014}
2015
2017{
2018 void **ptr;
2019
2020 if (CG(map_ptr_last) >= CG(map_ptr_size)) {
2021 /* Grow map_ptr table */
2022 CG(map_ptr_size) = ZEND_MM_ALIGNED_SIZE_EX(CG(map_ptr_last) + 1, 4096);
2023 CG(map_ptr_real_base) = perealloc(CG(map_ptr_real_base), (zend_map_ptr_static_size + CG(map_ptr_size)) * sizeof(void*), 1);
2024 CG(map_ptr_base) = ZEND_MAP_PTR_BIASED_BASE(CG(map_ptr_real_base));
2025 }
2026 ptr = (void**)CG(map_ptr_real_base) + zend_map_ptr_static_size + CG(map_ptr_last);
2027 *ptr = NULL;
2028 CG(map_ptr_last)++;
2030}
2031
2033{
2034 void **ptr;
2035
2038 /* Grow map_ptr table */
2039 void *new_base = pemalloc((zend_map_ptr_static_size + CG(map_ptr_size)) * sizeof(void*), 1);
2040 if (CG(map_ptr_real_base)) {
2041 memcpy((void **)new_base + 4096, CG(map_ptr_real_base), (CG(map_ptr_last) + zend_map_ptr_static_size - 4096) * sizeof(void *));
2042 pefree(CG(map_ptr_real_base), 1);
2043 }
2044 CG(map_ptr_real_base) = new_base;
2045 CG(map_ptr_base) = ZEND_MAP_PTR_BIASED_BASE(new_base);
2046 }
2047 ptr = (void**)CG(map_ptr_real_base) + (zend_map_ptr_static_last & 4095);
2048 *ptr = NULL;
2051}
2052
2054{
2055 if (last > CG(map_ptr_last)) {
2056 void **ptr;
2057
2058 if (last >= CG(map_ptr_size)) {
2059 /* Grow map_ptr table */
2060 CG(map_ptr_size) = ZEND_MM_ALIGNED_SIZE_EX(last, 4096);
2061 CG(map_ptr_real_base) = perealloc(CG(map_ptr_real_base), (zend_map_ptr_static_size + CG(map_ptr_size)) * sizeof(void*), 1);
2062 CG(map_ptr_base) = ZEND_MAP_PTR_BIASED_BASE(CG(map_ptr_real_base));
2063 }
2064 ptr = (void**)CG(map_ptr_real_base) + zend_map_ptr_static_size + CG(map_ptr_last);
2065 memset(ptr, 0, (last - CG(map_ptr_last)) * sizeof(void*));
2066 CG(map_ptr_last) = last;
2067 }
2068}
2069
2071{
2072 if (ZSTR_HAS_CE_CACHE(type_name) || !ZSTR_IS_INTERNED(type_name)) {
2073 return;
2074 }
2075
2076 if ((GC_FLAGS(type_name) & IS_STR_PERMANENT) && startup_done) {
2077 /* Don't allocate slot on permanent interned string outside module startup.
2078 * The cache slot would no longer be valid on the next request. */
2079 return;
2080 }
2081
2082 if (zend_string_equals_literal_ci(type_name, "self")
2083 || zend_string_equals_literal_ci(type_name, "parent")) {
2084 return;
2085 }
2086
2087 /* We use the refcount to keep map_ptr of corresponding type */
2088 uint32_t ret;
2089 do {
2091 } while (ret <= 2);
2093 GC_SET_REFCOUNT(type_name, ret);
2094}
size_t len
Definition apprentice.c:174
char * cb
Definition assert.c:26
bool exception
Definition assert.c:30
fprintf($stream, string $format, mixed ... $values)
getenv(?string $name=null, bool $local_only=false)
vfprintf($stream, string $format, array $values)
is_object(mixed $value)
fopen(string $filename, string $mode, bool $use_include_path=false, $context=null)
PW32CP const struct php_win32_cp * php_win32_cp_set_by_id(DWORD id)
Definition codepage.c:407
#define php_win32_cp_setup()
Definition codepage.h:45
error($message)
Definition ext_skel.php:22
zend_ffi_type * type
Definition ffi.c:3812
zval * zv
Definition ffi.c:3975
DL_HANDLE handle
Definition ffi.c:3028
zend_long n
Definition ffi.c:4979
new_type size
Definition ffi.c:4365
zend_string * res
Definition ffi.c:4692
void * ptr
Definition ffi.c:3814
memcpy(ptr1, ptr2, size)
zval * arg
Definition ffi.c:3975
memset(ptr, 0, type->size)
zval * val
Definition ffi.c:4262
HashTable * ht
Definition ffi.c:4838
zend_ffi_ctype_name_buf buf
Definition ffi.c:4685
zend_long offset
#define output_buf
Definition gd_topal.c:117
#define NULL
Definition gdcache.h:45
#define SUCCESS
Definition hash_sha3.c:261
#define zenderror
Definition php.h:336
JMP_BUF bailout
Definition php_ffi.h:49
#define abort()
#define min(a, b)
zend_op_array *(* compile_string)(zend_string *source_string, const char *filename, zend_compile_position position)
Definition phpdbg.h:274
zend_op_array *(* compile_file)(zend_file_handle *file_handle, int type)
Definition phpdbg.h:272
zend_constant * data
zend_object * ex
p
Definition session.c:1105
#define vsnprintf
Definition snprintf.h:104
zend_auto_global_callback auto_global_callback
zend_string * name
uint32_t lineno
Definition zend.h:131
zend_string * message
Definition zend.h:133
zend_string * filename
Definition zend.h:132
const char * version
const char * name
const char * author
const char * copyright
zend_string * opened_path
Definition zend_stream.h:59
void(* random_bytes_insecure_function)(zend_random_bytes_insecure_state *state, void *bytes, size_t size)
Definition zend.h:259
char *(* getenv_function)(const char *name, size_t name_len)
Definition zend.h:256
void(* printf_to_smart_str_function)(smart_str *buf, const char *format, va_list ap)
Definition zend.h:255
size_t(* printf_function)(const char *format,...) ZEND_ATTRIBUTE_PTR_FORMAT(printf
Definition zend.h:246
size_t size_t(* write_function)(const char *str, size_t str_length)
Definition zend.h:247
zend_string *(* resolve_path_function)(zend_string *filename)
Definition zend.h:257
void(* printf_to_smart_string_function)(smart_string *buf, const char *format, va_list ap)
Definition zend.h:254
void(* message_handler)(zend_long message, const void *data)
Definition zend.h:249
void(* on_timeout)(int seconds)
Definition zend.h:252
zval *(* get_configuration_directive)(zend_string *name)
Definition zend.h:250
zend_result(* stream_open_function)(zend_file_handle *handle)
Definition zend.h:253
FILE *(* fopen_function)(zend_string *filename, zend_string **opened_path)
Definition zend.h:248
void(* ticks_function)(int ticks)
Definition zend.h:251
void(* error_function)(int type, zend_string *error_filename, const uint32_t error_lineno, zend_string *message)
Definition zend.h:245
zend_result(* random_bytes_function)(void *bytes, size_t size, char *errstr, size_t errstr_size)
Definition zend.h:258
ZEND_API zval * zend_get_configuration_directive(zend_string *name)
Definition zend.c:1401
ZEND_API zend_string * zend_vstrpprintf(size_t max_len, const char *format, va_list ap)
Definition zend.c:335
ZEND_API zend_utility_values zend_uv
Definition zend.c:73
ZEND_API zend_result zend_execute_script(int type, zval *retval, zend_file_handle *file_handle)
Definition zend.c:1925
ZEND_API size_t zend_map_ptr_static_size
Definition zend.c:2008
ZEND_API ZEND_COLD void zend_error_unchecked(int type, const char *format,...)
Definition zend.c:1670
#define GLOBAL_FUNCTION_TABLE
Definition zend.c:67
ZEND_API bool zend_make_printable_zval(zval *expr, zval *expr_copy)
Definition zend.c:453
ZEND_API char * zend_make_compiled_string_description(const char *name)
Definition zend.c:1980
ZEND_API size_t zend_spprintf_unchecked(char **message, size_t max_len, const char *format,...)
Definition zend.c:323
ZEND_API zend_result zend_execute_scripts(int type, zval *retval, int file_count,...)
Definition zend.c:1954
ZEND_API zend_string * zend_strpprintf(size_t max_len, const char *format,...)
Definition zend.c:353
ZEND_API ZEND_COLD ZEND_NORETURN void _zend_bailout(const char *filename, uint32_t lineno)
Definition zend.c:1252
ZEND_API void(* zend_error_cb)(int type, zend_string *error_filename, const uint32_t error_lineno, zend_string *message)
Definition zend.c:90
ZEND_ATTRIBUTE_NONNULL ZEND_API void(* zend_random_bytes_insecure)(zend_random_bytes_insecure_state *state, void *bytes, size_t size)
Definition zend.c:99
ZEND_API ZEND_COLD void zend_error_zstr(int type, zend_string *message)
Definition zend.c:1731
ZEND_API ZEND_COLD void zend_error_at(int type, zend_string *filename, uint32_t lineno, const char *format,...)
Definition zend.c:1642
ZEND_API void zend_alloc_ce_cache(zend_string *type_name)
Definition zend.c:2070
#define GLOBAL_AUTO_GLOBALS_TABLE
Definition zend.c:69
ZEND_API FILE *(* zend_fopen)(zend_string *filename, zend_string **opened_path)
Definition zend.c:86
ZEND_API ZEND_COLD void zend_error_zstr_at(int orig_type, zend_string *error_filename, uint32_t error_lineno, zend_string *message)
Definition zend.c:1428
ZEND_API ZEND_COLD ZEND_NORETURN void zend_error_noreturn(int type, const char *format,...)
Definition zend.c:1703
#define PRINT_ZVAL_INDENT
Definition zend.c:80
#define SIGNAL_CHECK_DEFAULT
Definition zend.c:258
zend_result zend_post_startup(void)
Definition zend.c:1090
ZEND_API ZEND_COLD void zend_argument_count_error(const char *format,...)
Definition zend.c:1836
void free_estring(char **str_p)
Definition zend.c:2002
ZEND_API zend_string * zend_strpprintf_unchecked(size_t max_len, const char *format,...)
Definition zend.c:365
void zend_register_standard_ini_entries(void)
Definition zend.c:1080
ZEND_API ZEND_COLD void zend_output_debug_string(bool trigger_break, const char *format,...)
Definition zend.c:1861
void zend_shutdown(void)
Definition zend.c:1158
ZEND_API size_t zend_map_ptr_static_last
Definition zend.c:2009
#define COMPILED_STRING_DESCRIPTION_FORMAT
Definition zend.c:1978
ZEND_API zend_string * zend_print_zval_r_to_str(zval *expr, int indent)
Definition zend.c:616
ZEND_API zend_result(* zend_stream_open_function)(zend_file_handle *handle)
Definition zend.c:87
ZEND_API void zend_print_zval_r(zval *expr, int indent)
Definition zend.c:625
void zend_print_flat_zval_r_to_buf(smart_str *buf, zval *expr)
Definition zend.c:479
void zend_set_utility_values(zend_utility_values *utility_values)
Definition zend.c:1232
void(* zend_printf_to_smart_str)(smart_str *buf, const char *format, va_list ap)
Definition zend.c:92
ZEND_API const char * get_zend_version(void)
Definition zend.c:1306
ZEND_API zend_result(* zend_post_startup_cb)(void)
Definition zend.c:95
#define zend_error_impl(type, format)
Definition zend.c:1656
#define zend_error_noreturn_impl(type, format)
Definition zend.c:1691
ZEND_API ZEND_COLD void zend_throw_error(zend_class_entry *exception_ce, const char *format,...)
Definition zend.c:1772
ZEND_API zend_class_entry * zend_standard_class_def
Definition zend.c:83
ZEND_API void zend_activate(void)
Definition zend.c:1312
ZEND_API ZEND_COLD ZEND_NORETURN void zend_error_at_noreturn(int type, zend_string *filename, uint32_t lineno, const char *format,...)
Definition zend.c:1674
ZEND_API ZEND_COLD void zend_type_error(const char *format,...)
Definition zend.c:1824
ZEND_API void(* zend_post_shutdown_cb)(void)
Definition zend.c:96
void zend_call_destructors(void)
Definition zend.c:1329
#define GLOBAL_CONSTANTS_TABLE
Definition zend.c:70
ZEND_API ZEND_COLD void zend_value_error(const char *format,...)
Definition zend.c:1849
ZEND_API bool zend_dtrace_enabled
Definition zend.c:74
ZEND_API void zend_deactivate(void)
Definition zend.c:1337
ZEND_API size_t zend_get_page_size(void)
Definition zend.c:1269
ZEND_API ZEND_COLD ZEND_NORETURN void zend_error_noreturn_unchecked(int type, const char *format,...)
Definition zend.c:1708
ZEND_API ZEND_COLD void zend_error(int type, const char *format,...)
Definition zend.c:1666
ZEND_API void * zend_map_ptr_new_static(void)
Definition zend.c:2032
ZEND_ATTRIBUTE_NONNULL ZEND_API zend_result(* zend_random_bytes)(void *bytes, size_t size, char *errstr, size_t errstr_size)
Definition zend.c:98
ZEND_API zend_string *(* zend_resolve_path)(zend_string *filename)
Definition zend.c:94
ZEND_API ZEND_COLD void zend_illegal_container_offset(const zend_string *container, const zval *offset, int type)
Definition zend.c:1802
ZEND_API void(* zend_accel_schedule_restart_hook)(int reason)
Definition zend.c:97
#define SAVE_STACK(stack)
Definition zend.c:1411
ZEND_API size_t zend_spprintf(char **message, size_t max_len, const char *format,...)
Definition zend.c:311
#define ZEND_CORE_VERSION_INFO
Definition zend.c:79
#define compiler_options_default
Definition zend.c:647
ZEND_API size_t(* zend_printf)(const char *format,...)
Definition zend.c:84
void(* zend_on_timeout)(int seconds)
Definition zend.c:102
ZEND_API void zend_map_ptr_reset(void)
Definition zend.c:2011
ZEND_API void zend_print_flat_zval_r(zval *expr)
Definition zend.c:534
void(* zend_printf_to_smart_string)(smart_string *buf, const char *format, va_list ap)
Definition zend.c:91
void zend_startup(zend_utility_functions *utility_functions)
Definition zend.c:916
ZEND_API ZEND_COLD void zend_user_exception_handler(void)
Definition zend.c:1887
ZEND_API void zend_map_ptr_extend(size_t last)
Definition zend.c:2053
ZEND_API ZEND_COLD ZEND_NORETURN void zend_strerror_noreturn(int type, int errn, const char *message)
Definition zend.c:1713
#define RESTORE_STACK(stack)
Definition zend.c:1421
ZEND_API void zend_free_recorded_errors(void)
Definition zend.c:1755
ZEND_API void * zend_map_ptr_new(void)
Definition zend.c:2016
ZEND_API void zend_append_version_info(const zend_extension *extension)
Definition zend.c:1284
ZEND_API void zend_begin_record_errors(void)
Definition zend.c:1738
ZEND_API size_t zend_print_zval(zval *expr, int indent)
Definition zend.c:464
#define GLOBAL_CLASS_TABLE
Definition zend.c:68
ZEND_API size_t zend_vspprintf(char **pbuf, size_t max_len, const char *format, va_list ap)
Definition zend.c:283
ZEND_API void(* zend_ticks_function)(int ticks)
Definition zend.c:88
ZEND_API void(* zend_interrupt_function)(zend_execute_data *execute_data)
Definition zend.c:89
ZEND_API char *(* zend_getenv)(const char *name, size_t name_len)
Definition zend.c:93
ZEND_API void zend_emit_recorded_errors(void)
Definition zend.c:1746
ZEND_API zend_write_func_t zend_write
Definition zend.c:85
ZEND_API void zend_message_dispatcher(zend_long message, const void *data)
Definition zend.c:1393
#define short_tags_default
Definition zend.c:646
#define ZEND_PUTS(str)
Definition zend.h:335
void zend_unload_modules(void)
Definition zend_API.c:3415
struct _zend_utility_functions zend_utility_functions
struct _zend_error_info zend_error_info
@ EH_NORMAL
Definition zend.h:432
#define zend_try
Definition zend.h:270
size_t(* zend_write_func_t)(const char *str, size_t str_length)
Definition zend.h:266
struct _zend_utility_values zend_utility_values
#define zend_end_try()
Definition zend.h:280
ZEND_API const char * zend_get_type_by_const(int type)
Definition zend_API.c:112
ZEND_API HashTable module_registry
Definition zend_API.c:41
ZEND_API const char * zend_zval_type_name(const zval *arg)
Definition zend_API.c:167
void module_destructor(zend_module_entry *module)
Definition zend_API.c:3303
ZEND_API void zend_destroy_modules(void)
Definition zend_API.c:2577
#define call_user_function(function_table, object, function_name, retval_ptr, param_count, params)
Definition zend_API.h:687
ZEND_API void start_memory_manager(void)
#define estrndup(s, length)
Definition zend_alloc.h:165
#define efree_size(ptr, size)
Definition zend_alloc.h:138
#define ZEND_MM_ALIGNED_SIZE_EX(size, alignment)
Definition zend_alloc.h:37
#define perealloc(ptr, size, persistent)
Definition zend_alloc.h:201
#define efree(ptr)
Definition zend_alloc.h:155
#define pefree(ptr, persistent)
Definition zend_alloc.h:191
#define pemalloc(size, persistent)
Definition zend_alloc.h:189
#define erealloc(ptr, size)
Definition zend_alloc.h:159
#define emalloc(size)
Definition zend_alloc.h:151
void zend_attributes_shutdown(void)
zend_result zend_startup_builtin_functions(void)
struct _zval_struct zval
error_reporting(?int $error_level=null)
strlen(string $string)
exit(string|int $status=0)
zend_string_release_ex(func->internal_function.function_name, 0)
execute_data func
zval * args
ZEND_API zend_result zend_register_auto_global(zend_string *name, bool jit, zend_auto_global_callback auto_global_callback)
ZEND_API zend_executor_globals executor_globals
ZEND_API bool zend_is_compiling(void)
ZEND_API zend_compiler_globals compiler_globals
ZEND_API zend_op_array *(* zend_compile_file)(zend_file_handle *file_handle, int type)
ZEND_API zend_op_array *(* zend_compile_string)(zend_string *source_string, const char *filename, zend_compile_position position)
ZEND_API int zend_get_compiled_lineno(void)
void init_compiler(void)
ZEND_API zend_string * zend_get_compiled_filename(void)
void shutdown_compiler(void)
ZEND_API zend_result zend_unmangle_property_name_ex(const zend_string *name, const char **class_name, const char **prop_name, size_t *prop_len)
void startup_scanner(void)
#define ZEND_ACC_ENUM
struct _zend_op zend_op
#define ZEND_USER_CODE(type)
ZEND_API void destroy_op_array(zend_op_array *op_array)
#define ZEND_EVAL
#define ZEND_CLASS_DTOR
#define ZEND_FUNCTION_DTOR
#define ZEND_REQUIRE
struct _zend_op_array zend_op_array
#define ZEND_COMPILE_DEFAULT
ZEND_API void zend_destroy_static_vars(zend_op_array *op_array)
void shutdown_scanner(void)
void zend_class_add_ref(zval *zv)
struct _zend_auto_global zend_auto_global
#define BP_VAR_IS
#define BP_VAR_UNSET
#define ZEND_API
#define snprintf
void zend_register_standard_constants(void)
void zend_startup_constants(void)
#define ZEND_CONSTANT_DTOR
void zend_cpu_startup(void)
#define E_USER_NOTICE
Definition zend_errors.h:33
#define E_COMPILE_ERROR
Definition zend_errors.h:29
#define E_PARSE
Definition zend_errors.h:25
#define E_NOTICE
Definition zend_errors.h:26
#define E_ERROR
Definition zend_errors.h:23
#define E_WARNING
Definition zend_errors.h:24
#define E_CORE_ERROR
Definition zend_errors.h:27
#define E_USER_WARNING
Definition zend_errors.h:32
#define E_FATAL_ERRORS
Definition zend_errors.h:47
#define E_CORE_WARNING
Definition zend_errors.h:28
#define E_ALL
Definition zend_errors.h:43
#define E_USER_DEPRECATED
Definition zend_errors.h:38
#define E_USER_ERROR
Definition zend_errors.h:31
#define E_RECOVERABLE_ERROR
Definition zend_errors.h:36
#define E_DEPRECATED
Definition zend_errors.h:37
#define E_COMPILE_WARNING
Definition zend_errors.h:30
void zend_exception_restore(void)
ZEND_API bool zend_is_unwind_exit(const zend_object *ex)
ZEND_API zend_class_entry * zend_ce_value_error
ZEND_API zend_class_entry * zend_ce_type_error
ZEND_API ZEND_COLD zend_result zend_exception_error(zend_object *ex, int severity)
ZEND_API ZEND_COLD zend_object * zend_throw_exception(zend_class_entry *exception_ce, const char *message, zend_long code)
ZEND_API void(* zend_throw_exception_hook)(zend_object *ex)
ZEND_API zend_class_entry * zend_ce_parse_error
ZEND_API zend_class_entry * zend_ce_argument_count_error
ZEND_API zend_class_entry * zend_ce_error
ZEND_API void(ZEND_FASTCALL *zend_touch_vm_stack_data)(void *vm_stack_data)
void init_executor(void)
ZEND_API uint32_t zend_get_executed_lineno(void)
ZEND_API const char * zend_get_executed_filename(void)
void shutdown_destructors(void)
void shutdown_executor(void)
ZEND_API void(* zend_execute_ex)(zend_execute_data *execute_data)
ZEND_API void(* zend_execute_internal)(zend_execute_data *execute_data, zval *return_value)
ZEND_API void zend_execute(zend_op_array *op_array, zval *return_value)
ZEND_API void execute_ex(zend_execute_data *execute_data)
ZEND_API zend_string * zend_get_executed_filename_ex(void)
ZEND_API bool zend_is_executing(void)
ZEND_API void zend_init_internal_run_time_cache(void)
void zend_shutdown_extensions(void)
ZEND_API void zend_reset_internal_run_time_cache(void)
void zend_startup_extensions_mechanism(void)
struct _zend_extension zend_extension
#define ZEND_FIBER_DEFAULT_C_STACK_SIZE
Definition zend_fibers.h:28
size_t zend_flf_count
zend_function ** zend_flf_functions
ZEND_API void ** zend_flf_handlers
size_t zend_flf_capacity
ZEND_API bool gc_protect(bool protect)
Definition zend_gc.c:587
ZEND_API int(* gc_collect_cycles)(void)
Definition zend_gc.c:245
void gc_reset(void)
Definition zend_gc.c:533
ZEND_API int zend_gc_collect_cycles(void)
Definition zend_gc.c:1913
void gc_init(void)
Definition zend_gc.c:2280
#define EG_FLAGS_INITIAL
struct _zend_ini_scanner_globals zend_ini_scanner_globals
struct _zend_executor_globals zend_executor_globals
#define CG(v)
struct _zend_compiler_globals zend_compiler_globals
struct _zend_php_scanner_globals zend_php_scanner_globals
ZEND_API zend_ini_scanner_globals ini_scanner_globals
#define EG(v)
ZEND_API zend_php_scanner_globals language_scanner_globals
ZEND_API void ZEND_FASTCALL zend_hash_destroy(HashTable *ht)
Definition zend_hash.c:1727
ZEND_API void ZEND_FASTCALL zend_hash_graceful_reverse_destroy(HashTable *ht)
Definition zend_hash.c:2015
ZEND_API void ZEND_FASTCALL zend_hash_copy(HashTable *target, HashTable *source, copy_ctor_func_t pCopyConstructor)
Definition zend_hash.c:2240
ZEND_API zval *ZEND_FASTCALL zend_hash_add_empty_element(HashTable *ht, zend_string *key)
Definition zend_hash.c:1067
ZEND_API const HashTable zend_empty_array
Definition zend_hash.c:248
#define zend_hash_init(ht, nSize, pHashFunction, pDestructor, persistent)
Definition zend_hash.h:108
#define ZEND_HASH_FOREACH_END()
Definition zend_hash.h:1086
#define ZEND_HASH_FOREACH_KEY_VAL_IND(ht, _h, _key, _val)
Definition zend_hash.h:1203
void zend_startup_hrtime(void)
Definition zend_hrtime.c:56
ZEND_API void zend_ini_dtor(HashTable *ini_directives)
Definition zend_ini.c:116
ZEND_API void zend_ini_deactivate(void)
Definition zend_ini.c:130
ZEND_API zend_ulong zend_ini_parse_uquantity_warn(zend_string *value, zend_string *setting)
Definition zend_ini.c:883
ZEND_API bool zend_ini_parse_bool(zend_string *str)
Definition zend_ini.c:573
ZEND_API zend_result zend_register_ini_entries_ex(const zend_ini_entry_def *ini_entry, int module_number, int module_type)
Definition zend_ini.c:204
ZEND_API zend_long zend_ini_parse_quantity_warn(zend_string *value, zend_string *setting)
Definition zend_ini.c:869
ZEND_API void zend_ini_startup(void)
Definition zend_ini.c:99
#define ZEND_INI_STAGE_SHUTDOWN
Definition zend_ini.h:228
ZEND_API void zend_ini_refresh_caches(int stage)
#define ZEND_INI_BEGIN()
Definition zend_ini.h:150
#define ZEND_INI_SYSTEM
Definition zend_ini.h:26
ZEND_API void zend_copy_ini_directives(void)
#define ZEND_INI_STAGE_STARTUP
Definition zend_ini.h:227
#define ZEND_INI_MH(name)
Definition zend_ini.h:30
#define ZEND_INI_DISP(name)
Definition zend_ini.h:31
#define ZEND_INI_PERDIR
Definition zend_ini.h:25
#define STD_ZEND_INI_BOOLEAN(name, default_value, modifiable, on_modify, property_name, struct_type, struct_ptr)
Definition zend_ini.h:189
#define ZEND_INI_ENTRY(name, default_value, modifiable, on_modify)
Definition zend_ini.h:174
#define ZEND_INI_GET_ADDR()
Definition zend_ini.h:259
#define ZEND_INI_ENTRY3_EX(name, default_value, modifiable, on_modify, arg1, arg2, arg3, displayer)
Definition zend_ini.h:153
#define ZEND_INI_ALL
Definition zend_ini.h:28
#define ZEND_INI_END()
Definition zend_ini.h:151
#define STD_ZEND_INI_ENTRY(name, default_value, modifiable, on_modify, property_name, struct_type, struct_ptr)
Definition zend_ini.h:185
struct _zend_file_handle zend_file_handle
void zend_init_rsrc_list_dtors(void)
Definition zend_list.c:303
void zend_destroy_rsrc_list_dtors(void)
Definition zend_list.c:310
void zend_init_rsrc_plist(void)
Definition zend_list.c:209
void zend_destroy_rsrc_list(HashTable *ht)
Definition zend_list.c:232
#define ZEND_ULONG_FMT
Definition zend_long.h:88
int32_t zend_long
Definition zend_long.h:42
#define ZEND_ATOL(s)
Definition zend_long.h:101
uint32_t zend_ulong
Definition zend_long.h:43
#define ZEND_LONG_FMT
Definition zend_long.h:87
struct _zend_string zend_string
#define ZEND_MAP_PTR_PTR2OFFSET(ptr)
#define ZEND_MAP_PTR_BIASED_BASE(real_base)
#define ZEND_MAP_PTR_NEW_OFFSET()
#define zend_max_execution_timer_init()
struct _zend_module_entry zend_module_entry
#define MODULE_PERSISTENT
ZEND_API zend_result zend_multibyte_set_script_encoding_by_string(const char *new_value, size_t new_value_length)
ZEND_API const zend_multibyte_functions * zend_multibyte_get_functions(void)
struct _zend_encoding zend_encoding
ZEND_API HashTable * zend_get_properties_for(zval *obj, zend_prop_purpose purpose)
ZEND_API uint32_t * zend_get_recursion_guard(zend_object *zobj)
#define zend_release_properties(ht)
@ ZEND_PROP_PURPOSE_DEBUG
#define OBJ_RELEASE(obj)
ZEND_API void zend_observer_error_register(zend_observer_error_cb cb)
ZEND_API void zend_observer_activate(void)
ZEND_API zend_string *ZEND_FASTCALL zval_get_string_func(zval *op)
int last
zend_result zend_optimizer_startup(void)
zend_result zend_optimizer_shutdown(void)
#define LONGJMP(a, b)
#define ZEND_ATTRIBUTE_NONNULL
#define ZEND_ASSERT(c)
#define ZEND_UNREACHABLE()
#define ZEND_VOIDP(ptr)
#define ZEND_COLD
#define UNEXPECTED(condition)
#define ZEND_NORETURN
struct _zend_class_entry zend_class_entry
struct _zend_object zend_object
ZEND_API int zend_stack_push(zend_stack *stack, const void *element)
Definition zend_stack.c:33
ZEND_API void * zend_stack_top(const zend_stack *stack)
Definition zend_stack.c:45
ZEND_API void zend_stack_del_top(zend_stack *stack)
Definition zend_stack.c:55
struct _zend_stack zend_stack
ZEND_API void zend_interned_strings_init(void)
Definition zend_string.c:86
ZEND_API void zend_interned_strings_dtor(void)
ZEND_API zend_string_init_interned_func_t zend_string_init_interned
Definition zend_string.c:31
#define ZSTR_IS_INTERNED(s)
Definition zend_string.h:84
#define ZSTR_VAL(zstr)
Definition zend_string.h:68
#define ZSTR_KNOWN(idx)
#define ZSTR_EMPTY_ALLOC()
#define ZSTR_LEN(zstr)
Definition zend_string.h:69
#define zend_string_equals_literal_ci(str, c)
ZEND_API int zend_shutdown_strtod(void)
#define Z_OBJ_HANDLER_P(zv_p, hf)
Definition zend_types.h:996
#define Z_TYPE_P(zval_p)
Definition zend_types.h:660
#define ZVAL_STR(z, s)
#define GC_PROTECT_RECURSION(p)
Definition zend_types.h:868
#define ZEND_GUARD_OR_GC_PROTECT_RECURSION(pg, t, zobj)
Definition zend_types.h:894
#define IS_STR_CLASS_NAME_MAP_PTR
Definition zend_types.h:816
#define IS_STR_PERMANENT
Definition zend_types.h:819
#define ZVAL_UNDEF(z)
#define GC_SET_REFCOUNT(p, rc)
Definition zend_types.h:708
#define Z_REFVAL_P(zval_p)
#define IS_FALSE
Definition zend_types.h:602
#define IS_UNDEF
Definition zend_types.h:600
#define Z_ARRVAL_P(zval_p)
Definition zend_types.h:987
#define ZVAL_NULL(z)
#define ZVAL_LONG(z, l)
#define IS_STRING
Definition zend_types.h:606
#define ZVAL_STR_COPY(z, s)
struct _zend_array HashTable
Definition zend_types.h:386
#define Z_OBJ_P(zval_p)
Definition zend_types.h:990
#define IS_ARRAY
Definition zend_types.h:607
#define Z_COUNTED_P(zval_p)
Definition zend_types.h:699
#define Z_STR_P(zval_p)
Definition zend_types.h:972
#define Z_PTR_P(zval_p)
#define GC_FLAGS(p)
Definition zend_types.h:756
#define ZSTR_HAS_CE_CACHE(s)
Definition zend_types.h:841
#define GC_TRY_UNPROTECT_RECURSION(p)
Definition zend_types.h:880
#define ZVAL_OBJ(z, o)
@ FAILURE
Definition zend_types.h:61
#define IS_OBJECT
Definition zend_types.h:608
#define IS_LONG
Definition zend_types.h:604
#define IS_REFERENCE
Definition zend_types.h:610
#define GC_UNPROTECT_RECURSION(p)
Definition zend_types.h:872
struct _Bucket Bucket
#define Z_OBJPROP_P(zval_p)
#define ZEND_GUARD_OR_GC_IS_RECURSIVE(pg, t, zobj)
Definition zend_types.h:891
ZEND_RESULT_CODE zend_result
Definition zend_types.h:64
#define ZEND_GUARD_OR_GC_UNPROTECT_RECURSION(pg, t, zobj)
Definition zend_types.h:902
#define GC_IS_RECURSIVE(p)
Definition zend_types.h:865
#define Z_TYPE(zval)
Definition zend_types.h:659
struct _zend_execute_data zend_execute_data
Definition zend_types.h:91
#define Z_LVAL_P(zval_p)
Definition zend_types.h:966
#define ZVAL_COPY_VALUE(z, v)
#define GC_IMMUTABLE
Definition zend_types.h:780
#define GC_ADD_FLAGS(p, flags)
Definition zend_types.h:759
ZEND_API void zval_ptr_dtor(zval *zval_ptr)
CWD_API void virtual_cwd_shutdown(void)
CWD_API void virtual_cwd_activate(void)
CWD_API void virtual_cwd_deactivate(void)
CWD_API void virtual_cwd_startup(void)
void zend_vm_init(void)
#define ZEND_VM_SET_OPCODE_HANDLER(opline)
Definition zend_vm.h:44
void zend_vm_dtor(void)
container
zval retval
zend_string * name
execute_data
zval * ret
zend_object * zobj
#define ZEND_INCLUDE_OR_EVAL
#define ZEND_CALL_TRAMPOLINE
#define ZEND_HANDLE_EXCEPTION