$75 GRAYBYTE WORDPRESS FILE MANAGER $54

SERVER : premium201.web-hosting.com #1 SMP Wed Mar 26 12:08:09 UTC 2025
SERVER IP : 172.67.162.162 | ADMIN IP 216.73.217.100
OPTIONS : CRL = ON | WGT = ON | SDO = OFF | PKEX = OFF
DEACTIVATED : NONE

/opt/alt/php85/usr/include/php/Zend/

HOME
Current File : /opt/alt/php85/usr/include/php/Zend//zend_verify_type_inference.h
/*
   +----------------------------------------------------------------------+
   | Zend Engine                                                          |
   +----------------------------------------------------------------------+
   | Copyright (c) Zend Technologies Ltd. (http://www.zend.com)           |
   +----------------------------------------------------------------------+
   | This source file is subject to version 2.00 of the Zend license,     |
   | that is bundled with this package in the file LICENSE, and is        |
   | available through the world-wide-web at the following url:           |
   | http://www.zend.com/license/2_00.txt.                                |
   | If you did not receive a copy of the Zend license and are unable to  |
   | obtain it through the world-wide-web, please send a note to          |
   | [email protected] so we can mail you a copy immediately.              |
   +----------------------------------------------------------------------+
*/

#include "zend_type_info.h"
#include "zend_compile.h"

#define VM_TRACE_START()
#define VM_TRACE_END()
#define VM_TRACE(op) zend_verify_inference_use(execute_data, OPLINE); \
	{ \
		zend_execute_data *__current_ex = NULL; \
		const zend_op *__current_op = NULL; \
		if (OPLINE->opcode != ZEND_GENERATOR_RETURN) { \
			__current_ex = execute_data; __current_op = OPLINE; \
		}
#define VM_TRACE_OP_END(op) \
		if (__current_ex && __current_op) { \
			zend_verify_inference_def(__current_ex, __current_op); \
		} \
	}

#define ZEND_VERIFY_TYPE_INFERENCE_ERROR(msg, ...) \
	do { \
		fprintf(stderr, "Inference verification failed at %04d %s (" msg ")\n", (int)(opline - EX(func)->op_array.opcodes), operand, __VA_ARGS__); \
		_exit(139); \
	} while (0)

static void zend_verify_type_inference(zval *value, uint32_t type_mask, uint8_t op_type, zend_execute_data *execute_data, const zend_op *opline, const char *operand)
{
	if (type_mask == MAY_BE_CLASS) {
		return;
	}

	if (Z_TYPE_P(value) == IS_INDIRECT) {
		if (!(type_mask & MAY_BE_INDIRECT)) {
			ZEND_VERIFY_TYPE_INFERENCE_ERROR("mask 0x%x missing MAY_BE_INDIRECT", type_mask);
		}
		value = Z_INDIRECT_P(value);
	}

	/* Verifying RC inference is currently not possible because type information is based on the SSA
	 * built without ZEND_SSA_RC_INFERENCE, which is missing various definitions for RC-modifying
	 * operations. Support could be added by repeating SSA-construction and type inference with the
	 * given flag. */
	// if (Z_REFCOUNTED_P(value)) {
	// 	if (Z_REFCOUNT_P(value) == 1 && !(type_mask & MAY_BE_RC1)) {
	// 		ZEND_VERIFY_TYPE_INFERENCE_ERROR("mask 0x%x missing MAY_BE_RC1", type_mask);
	// 	}
	// 	if (Z_REFCOUNT_P(value) > 1 && !(type_mask & MAY_BE_RCN)) {
	// 		ZEND_VERIFY_TYPE_INFERENCE_ERROR("mask 0x%x missing MAY_BE_RCN", type_mask);
	// 	}
	// }

	if (Z_TYPE_P(value) == IS_REFERENCE) {
		if (!(type_mask & MAY_BE_REF)) {
			ZEND_VERIFY_TYPE_INFERENCE_ERROR("mask 0x%x missing MAY_BE_REF", type_mask);
		}
		value = Z_REFVAL_P(value);
	}

	if (!(type_mask & (1u << Z_TYPE_P(value)))) {
		if (Z_TYPE_P(value) == IS_UNUSED && op_type == IS_VAR && (type_mask & MAY_BE_NULL)) {
			/* FETCH_OBJ_* for typed property may return IS_UNDEF. This is an exception. */
		} else {
			ZEND_VERIFY_TYPE_INFERENCE_ERROR("mask 0x%x missing type %d", type_mask, Z_TYPE_P(value));
		}
	}

	if (Z_TYPE_P(value) == IS_ARRAY) {
		HashTable *ht = Z_ARRVAL_P(value);
		uint32_t num_checked = 0;
		zend_string *str;
		zval *val;
		if (HT_IS_INITIALIZED(ht)) {
			if (HT_IS_PACKED(ht) && !MAY_BE_PACKED(type_mask)) {
				ZEND_VERIFY_TYPE_INFERENCE_ERROR("mask 0x%x missing MAY_BE_ARRAY_PACKED", type_mask);
			}
			if (!HT_IS_PACKED(ht) && !MAY_BE_HASH(type_mask)) {
				ZEND_VERIFY_TYPE_INFERENCE_ERROR("mask 0x%x missing MAY_BE_ARRAY_HASH", type_mask);
			}
		} else {
			if (!(type_mask & MAY_BE_ARRAY_EMPTY)) {
				ZEND_VERIFY_TYPE_INFERENCE_ERROR("mask 0x%x missing MAY_BE_ARRAY_EMPTY", type_mask);
			}
		}
		ZEND_HASH_FOREACH_STR_KEY_VAL(ht, str, val) {
			if (str) {
				if (!(type_mask & MAY_BE_ARRAY_KEY_STRING)) {
					ZEND_VERIFY_TYPE_INFERENCE_ERROR("mask 0x%x missing MAY_BE_ARRAY_KEY_STRING", type_mask);
					break;
				}
			} else {
				if (!(type_mask & MAY_BE_ARRAY_KEY_LONG)) {
					ZEND_VERIFY_TYPE_INFERENCE_ERROR("mask 0x%x missing MAY_BE_ARRAY_KEY_LONG", type_mask);
					break;
				}
			}

			uint32_t array_type = 1u << (Z_TYPE_P(val) + MAY_BE_ARRAY_SHIFT);
			if (!(type_mask & array_type)) {
				ZEND_VERIFY_TYPE_INFERENCE_ERROR("mask 0x%x missing array type %d", type_mask, Z_TYPE_P(val));
				break;
			}

			/* Don't check all elements of large arrays. */
			if (++num_checked > 16) {
				break;
			}
		} ZEND_HASH_FOREACH_END();
	}
}

/* Clang reports false positive unused warnings. */
#ifdef __clang__
__attribute__((unused))
#endif
static void zend_verify_inference_use(zend_execute_data *execute_data, const zend_op *opline)
{
	if (opline->op1_use_type
	 && (opline->op1_type & (IS_TMP_VAR|IS_VAR|IS_CV))
	 && opline->opcode != ZEND_ROPE_ADD
	 && opline->opcode != ZEND_ROPE_END) {
		zend_verify_type_inference(EX_VAR(opline->op1.var), opline->op1_use_type, opline->op1_type, execute_data, opline, "op1_use");
	}
	if (opline->op2_use_type
	 && (opline->op2_type & (IS_TMP_VAR|IS_VAR|IS_CV))) {
		zend_verify_type_inference(EX_VAR(opline->op2.var), opline->op2_use_type, opline->op2_type, execute_data, opline, "op2_use");
	}
	if (opline->result_use_type
	 && (opline->result_type & (IS_TMP_VAR|IS_VAR|IS_CV))) {
		zend_verify_type_inference(EX_VAR(opline->result.var), opline->result_use_type, opline->result_type, execute_data, opline, "result_use");
	}
}

/* Clang reports false positive unused warnings. */
#ifdef __clang__
__attribute__((unused))
#endif
static void zend_verify_inference_def(zend_execute_data *execute_data, const zend_op *opline)
{
	if (EG(exception)) {
		return;
	}
	if (opline->op1_def_type
	 && (opline->op1_type & (IS_TMP_VAR|IS_VAR|IS_CV))
	 // array is actually changed by the the following instruction(s)
	 && opline->opcode != ZEND_FETCH_DIM_W
	 && opline->opcode != ZEND_FETCH_DIM_RW
	 && opline->opcode != ZEND_FETCH_DIM_FUNC_ARG
	 && opline->opcode != ZEND_FETCH_LIST_W) {
		zend_verify_type_inference(EX_VAR(opline->op1.var), opline->op1_def_type, opline->op1_type, execute_data, opline, "op1_def");
	}
	if (opline->op2_def_type
	 && (opline->op2_type & (IS_TMP_VAR|IS_VAR|IS_CV))
	 /* ZEND_FE_FETCH_R[W] does not define a result in the last iteration. */
	 && opline->opcode != ZEND_FE_FETCH_R
	 && opline->opcode != ZEND_FE_FETCH_RW) {
		zend_verify_type_inference(EX_VAR(opline->op2.var), opline->op2_def_type, opline->op2_type, execute_data, opline, "op2_def");
	}
	if (opline->result_def_type
	 && (opline->result_type & (IS_TMP_VAR|IS_VAR|IS_CV))
	 && opline->opcode != ZEND_ROPE_INIT
	 && opline->opcode != ZEND_ROPE_ADD
	 /* Some jump opcode handlers don't set result when it's never read. */
	 && opline->opcode != ZEND_JMP_SET
	 && opline->opcode != ZEND_JMP_NULL
	 && opline->opcode != ZEND_COALESCE
	 && opline->opcode != ZEND_ASSERT_CHECK
	 /* Smart branches may not declare result. */
	 && !zend_is_smart_branch(opline)
	 /* User calls only initialize result when returning from the called function. */
	 && opline->opcode != ZEND_DO_FCALL
	 && opline->opcode != ZEND_DO_UCALL
	 && opline->opcode != ZEND_DO_FCALL_BY_NAME
	 /* ZEND_FE_FETCH_R[W] does not define a result in the last iteration. */
	 && opline->opcode != ZEND_FE_FETCH_R
	 && opline->opcode != ZEND_FE_FETCH_RW) {
		zend_verify_type_inference(EX_VAR(opline->result.var), opline->result_def_type, opline->result_type, execute_data, opline, "result_def");

		/* Verify return value in the context of caller. */
		if ((opline->opcode == ZEND_RETURN || opline->opcode == ZEND_RETURN_BY_REF)
		 && execute_data->prev_execute_data
		 && execute_data->prev_execute_data->func
		 && ZEND_USER_CODE(execute_data->prev_execute_data->func->type)) {
			zend_execute_data *prev_execute_data = execute_data->prev_execute_data;
			const zend_op *opline = execute_data->prev_execute_data->opline;
			zend_verify_type_inference(ZEND_CALL_VAR(prev_execute_data, opline->result.var), opline->result_def_type, opline->result_type, prev_execute_data, opline, "result_def");
		}
	}
}


Current_dir [ NOT WRITEABLE ] Document_root [ WRITEABLE ]


[ Back ]
NAME
SIZE
LAST TOUCH
USER
CAN-I?
FUNCTIONS
..
--
19 Mar 2026 4.16 PM
root / linksafe
0755
Optimizer
--
8 Apr 2026 8.32 AM
root / linksafe
0755
zend.h
17.336 KB
19 Mar 2026 4.16 PM
root / linksafe
0644
zend_API.h
106.553 KB
19 Mar 2026 4.16 PM
root / linksafe
0644
zend_alloc.h
20.319 KB
19 Mar 2026 4.16 PM
root / linksafe
0644
zend_alloc_sizes.h
2.567 KB
19 Mar 2026 4.16 PM
root / linksafe
0644
zend_arena.h
5.938 KB
19 Mar 2026 4.16 PM
root / linksafe
0644
zend_ast.h
14.5 KB
19 Mar 2026 4.16 PM
root / linksafe
0644
zend_atomic.h
12.774 KB
19 Mar 2026 4.16 PM
root / linksafe
0644
zend_attributes.h
6.435 KB
19 Mar 2026 4.16 PM
root / linksafe
0644
zend_attributes_arginfo.h
15.501 KB
19 Mar 2026 4.16 PM
root / linksafe
0644
zend_bitset.h
7.841 KB
19 Mar 2026 4.16 PM
root / linksafe
0644
zend_build.h
1.588 KB
19 Mar 2026 4.16 PM
root / linksafe
0644
zend_builtin_functions.h
1.536 KB
19 Mar 2026 4.16 PM
root / linksafe
0644
zend_builtin_functions_arginfo.h
15.493 KB
19 Mar 2026 4.16 PM
root / linksafe
0644
zend_call_stack.h
3.068 KB
19 Mar 2026 4.16 PM
root / linksafe
0644
zend_closures.h
2.261 KB
19 Mar 2026 4.16 PM
root / linksafe
0644
zend_closures_arginfo.h
2.253 KB
19 Mar 2026 4.16 PM
root / linksafe
0644
zend_compile.h
53.205 KB
19 Mar 2026 4.16 PM
root / linksafe
0644
zend_config.h
0.031 KB
19 Mar 2026 4.16 PM
root / linksafe
0644
zend_constants.h
7.144 KB
19 Mar 2026 4.16 PM
root / linksafe
0644
zend_constants_arginfo.h
2.646 KB
19 Mar 2026 4.16 PM
root / linksafe
0644
zend_cpuinfo.h
9.29 KB
19 Mar 2026 4.16 PM
root / linksafe
0644
zend_dtrace.h
2.003 KB
19 Mar 2026 4.16 PM
root / linksafe
0644
zend_enum.h
2.859 KB
19 Mar 2026 4.16 PM
root / linksafe
0644
zend_enum_arginfo.h
1.651 KB
19 Mar 2026 4.16 PM
root / linksafe
0644
zend_errors.h
2.359 KB
19 Mar 2026 4.16 PM
root / linksafe
0644
zend_exceptions.h
4.472 KB
19 Mar 2026 4.16 PM
root / linksafe
0644
zend_exceptions_arginfo.h
15.427 KB
19 Mar 2026 4.16 PM
root / linksafe
0644
zend_execute.h
26.587 KB
19 Mar 2026 4.16 PM
root / linksafe
0644
zend_extensions.h
6.434 KB
19 Mar 2026 4.16 PM
root / linksafe
0644
zend_fibers.h
5.285 KB
19 Mar 2026 4.16 PM
root / linksafe
0644
zend_fibers_arginfo.h
3.447 KB
19 Mar 2026 4.16 PM
root / linksafe
0644
zend_float.h
15.105 KB
19 Mar 2026 4.16 PM
root / linksafe
0644
zend_frameless_function.h
5.389 KB
19 Mar 2026 4.16 PM
root / linksafe
0644
zend_gc.h
4.908 KB
19 Mar 2026 4.16 PM
root / linksafe
0644
zend_gdb.h
1.387 KB
19 Mar 2026 4.16 PM
root / linksafe
0644
zend_generators.h
7.484 KB
19 Mar 2026 4.16 PM
root / linksafe
0644
zend_generators_arginfo.h
2.821 KB
19 Mar 2026 4.16 PM
root / linksafe
0644
zend_globals.h
9.913 KB
19 Mar 2026 4.16 PM
root / linksafe
0644
zend_globals_macros.h
2.774 KB
19 Mar 2026 4.16 PM
root / linksafe
0644
zend_hash.h
51.24 KB
19 Mar 2026 4.16 PM
root / linksafe
0644
zend_highlight.h
2.267 KB
19 Mar 2026 4.16 PM
root / linksafe
0644
zend_hrtime.h
4.147 KB
19 Mar 2026 4.16 PM
root / linksafe
0644
zend_inheritance.h
3.129 KB
19 Mar 2026 4.16 PM
root / linksafe
0644
zend_ini.h
11.909 KB
19 Mar 2026 4.16 PM
root / linksafe
0644
zend_ini_parser.h
2.686 KB
19 Mar 2026 4.16 PM
root / linksafe
0644
zend_ini_scanner.h
1.932 KB
19 Mar 2026 4.16 PM
root / linksafe
0644
zend_ini_scanner_defs.h
0.24 KB
19 Mar 2026 4.16 PM
root / linksafe
0644
zend_interfaces.h
4.021 KB
19 Mar 2026 4.16 PM
root / linksafe
0644
zend_interfaces_arginfo.h
7.655 KB
19 Mar 2026 4.16 PM
root / linksafe
0644
zend_iterators.h
3.81 KB
19 Mar 2026 4.16 PM
root / linksafe
0644
zend_language_parser.h
6.092 KB
19 Mar 2026 4.16 PM
root / linksafe
0644
zend_language_scanner.h
2.999 KB
19 Mar 2026 4.16 PM
root / linksafe
0644
zend_language_scanner_defs.h
0.303 KB
19 Mar 2026 4.16 PM
root / linksafe
0644
zend_lazy_objects.h
4.661 KB
19 Mar 2026 4.16 PM
root / linksafe
0644
zend_list.h
3.401 KB
19 Mar 2026 4.16 PM
root / linksafe
0644
zend_llist.h
3.938 KB
19 Mar 2026 4.16 PM
root / linksafe
0644
zend_long.h
4.128 KB
19 Mar 2026 4.16 PM
root / linksafe
0644
zend_map_ptr.h
3.487 KB
19 Mar 2026 4.16 PM
root / linksafe
0644
zend_max_execution_timer.h
1.48 KB
19 Mar 2026 4.16 PM
root / linksafe
0644
zend_mmap.h
1.477 KB
19 Mar 2026 4.16 PM
root / linksafe
0644
zend_modules.h
4.713 KB
19 Mar 2026 4.16 PM
root / linksafe
0644
zend_multibyte.h
4.83 KB
19 Mar 2026 4.16 PM
root / linksafe
0644
zend_multiply.h
10.089 KB
19 Mar 2026 4.16 PM
root / linksafe
0644
zend_object_handlers.h
18.062 KB
19 Mar 2026 4.16 PM
root / linksafe
0644
zend_objects.h
2.024 KB
19 Mar 2026 4.16 PM
root / linksafe
0644
zend_objects_API.h
5.84 KB
19 Mar 2026 4.16 PM
root / linksafe
0644
zend_observer.h
8.824 KB
19 Mar 2026 4.16 PM
root / linksafe
0644
zend_operators.h
35.873 KB
19 Mar 2026 4.16 PM
root / linksafe
0644
zend_portability.h
28.122 KB
19 Mar 2026 4.16 PM
root / linksafe
0644
zend_property_hooks.h
1.781 KB
19 Mar 2026 4.16 PM
root / linksafe
0644
zend_ptr_stack.h
4.22 KB
19 Mar 2026 4.16 PM
root / linksafe
0644
zend_range_check.h
2.93 KB
19 Mar 2026 4.16 PM
root / linksafe
0644
zend_signal.h
4.009 KB
19 Mar 2026 4.16 PM
root / linksafe
0644
zend_simd.h
19.639 KB
19 Mar 2026 4.16 PM
root / linksafe
0644
zend_smart_str.h
6.88 KB
19 Mar 2026 4.16 PM
root / linksafe
0644
zend_smart_str_public.h
1.193 KB
19 Mar 2026 4.16 PM
root / linksafe
0644
zend_smart_string.h
4.23 KB
19 Mar 2026 4.16 PM
root / linksafe
0644
zend_smart_string_public.h
1.211 KB
19 Mar 2026 4.16 PM
root / linksafe
0644
zend_sort.h
1.523 KB
19 Mar 2026 4.16 PM
root / linksafe
0644
zend_stack.h
2.385 KB
19 Mar 2026 4.16 PM
root / linksafe
0644
zend_stream.h
3.556 KB
19 Mar 2026 4.16 PM
root / linksafe
0644
zend_string.h
22.409 KB
19 Mar 2026 4.16 PM
root / linksafe
0644
zend_strtod.h
2.289 KB
19 Mar 2026 4.16 PM
root / linksafe
0644
zend_strtod_int.h
2.807 KB
19 Mar 2026 4.16 PM
root / linksafe
0644
zend_system_id.h
1.391 KB
19 Mar 2026 4.16 PM
root / linksafe
0644
zend_type_info.h
4.438 KB
19 Mar 2026 4.16 PM
root / linksafe
0644
zend_types.h
51.843 KB
19 Mar 2026 4.16 PM
root / linksafe
0644
zend_variables.h
3.064 KB
19 Mar 2026 4.16 PM
root / linksafe
0644
zend_verify_type_inference.h
8.068 KB
19 Mar 2026 4.16 PM
root / linksafe
0644
zend_virtual_cwd.h
12.891 KB
19 Mar 2026 4.16 PM
root / linksafe
0644
zend_vm.h
2.063 KB
19 Mar 2026 4.16 PM
root / linksafe
0644
zend_vm_def.h
298.83 KB
19 Mar 2026 4.16 PM
root / linksafe
0644
zend_vm_execute.h
4 MB
19 Mar 2026 4.16 PM
root / linksafe
0644
zend_vm_handlers.h
90.992 KB
19 Mar 2026 4.16 PM
root / linksafe
0644
zend_vm_opcodes.h
15.093 KB
19 Mar 2026 4.16 PM
root / linksafe
0644
zend_vm_trace_handlers.h
3.141 KB
19 Mar 2026 4.16 PM
root / linksafe
0644
zend_vm_trace_lines.h
1.714 KB
19 Mar 2026 4.16 PM
root / linksafe
0644
zend_vm_trace_map.h
2.603 KB
19 Mar 2026 4.16 PM
root / linksafe
0644
zend_weakrefs.h
3.379 KB
19 Mar 2026 4.16 PM
root / linksafe
0644
zend_weakrefs_arginfo.h
3.359 KB
19 Mar 2026 4.16 PM
root / linksafe
0644

GRAYBYTE WORDPRESS FILE MANAGER @ 2025 CONTACT ME
Static GIF