Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Zend/zend.c
Original file line number Diff line number Diff line change
Expand Up @@ -1392,7 +1392,7 @@ ZEND_API ZEND_COLD void zend_throw_error(zend_class_entry *exception_ce, const c
{
va_list va;
char *message = NULL;

if (exception_ce) {
if (!instanceof_function(exception_ce, zend_ce_error)) {
zend_error(E_NOTICE, "Error exceptions must be derived from Error");
Expand Down
10 changes: 5 additions & 5 deletions Zend/zend_API.c
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_parameters_count_error(zend_boo

zend_internal_argument_count_error(
throw_ || ZEND_ARG_USES_STRICT_TYPES(),
"%s%s%s() expects %s %d parameter%s, %d given",
"%s%s%s() expects %s %d parameter%s, %d given",
class_name, \
class_name[0] ? "::" : "", \
ZSTR_VAL(active_function->common.function_name),
Expand Down Expand Up @@ -2226,7 +2226,7 @@ ZEND_API int zend_register_functions(zend_class_entry *scope, const zend_functio
}

if (reg_function->common.arg_info &&
(reg_function->common.fn_flags & (ZEND_ACC_HAS_RETURN_TYPE|ZEND_ACC_HAS_TYPE_HINTS))) {
(reg_function->common.fn_flags & (ZEND_ACC_HAS_RETURN_TYPE|ZEND_ACC_HAS_TYPE_HINTS))) {
/* convert "const char*" class type names into "zend_string*" */
uint32_t i;
uint32_t num_args = reg_function->common.num_args + 1;
Expand Down Expand Up @@ -3067,7 +3067,7 @@ static int zend_is_callable_check_func(int check_flags, zval *callable, zend_fca
(!fcc->function_handler->common.scope ||
!instanceof_function(ce_org, fcc->function_handler->common.scope))) {
if (fcc->function_handler->common.fn_flags & ZEND_ACC_CALL_VIA_TRAMPOLINE) {
if (fcc->function_handler->type != ZEND_OVERLOADED_FUNCTION &&
if (fcc->function_handler->type != ZEND_OVERLOADED_FUNCTION &&
fcc->function_handler->common.function_name) {
zend_string_release(fcc->function_handler->common.function_name);
}
Expand Down Expand Up @@ -3293,7 +3293,7 @@ static zend_bool zend_is_callable_impl(zval *callable, zend_object *object, uint
((fcc->function_handler->common.fn_flags & ZEND_ACC_CALL_VIA_TRAMPOLINE) ||
fcc->function_handler->type == ZEND_OVERLOADED_FUNCTION_TEMPORARY ||
fcc->function_handler->type == ZEND_OVERLOADED_FUNCTION)) {
if (fcc->function_handler->type != ZEND_OVERLOADED_FUNCTION &&
if (fcc->function_handler->type != ZEND_OVERLOADED_FUNCTION &&
fcc->function_handler->common.function_name) {
zend_string_release(fcc->function_handler->common.function_name);
}
Expand Down Expand Up @@ -3352,7 +3352,7 @@ static zend_bool zend_is_callable_impl(zval *callable, zend_object *object, uint
((fcc->function_handler->common.fn_flags & ZEND_ACC_CALL_VIA_TRAMPOLINE) ||
fcc->function_handler->type == ZEND_OVERLOADED_FUNCTION_TEMPORARY ||
fcc->function_handler->type == ZEND_OVERLOADED_FUNCTION)) {
if (fcc->function_handler->type != ZEND_OVERLOADED_FUNCTION &&
if (fcc->function_handler->type != ZEND_OVERLOADED_FUNCTION &&
fcc->function_handler->common.function_name) {
zend_string_release(fcc->function_handler->common.function_name);
}
Expand Down
6 changes: 3 additions & 3 deletions Zend/zend_builtin_functions.c
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,7 @@ ZEND_FUNCTION(func_get_args)
q = p;
if (EXPECTED(Z_TYPE_INFO_P(q) != IS_UNDEF)) {
ZVAL_DEREF(q);
if (Z_OPT_REFCOUNTED_P(q)) {
if (Z_OPT_REFCOUNTED_P(q)) {
Z_ADDREF_P(q);
}
} else {
Expand All @@ -500,7 +500,7 @@ ZEND_FUNCTION(func_get_args)
q = p;
if (EXPECTED(Z_TYPE_INFO_P(q) != IS_UNDEF)) {
ZVAL_DEREF(q);
if (Z_OPT_REFCOUNTED_P(q)) {
if (Z_OPT_REFCOUNTED_P(q)) {
Z_ADDREF_P(q);
}
} else {
Expand Down Expand Up @@ -1273,7 +1273,7 @@ ZEND_FUNCTION(method_exists)
Z_PARAM_ZVAL(klass)
Z_PARAM_STR(method_name)
ZEND_PARSE_PARAMETERS_END();

if (Z_TYPE_P(klass) == IS_OBJECT) {
ce = Z_OBJCE_P(klass);
} else if (Z_TYPE_P(klass) == IS_STRING) {
Expand Down
20 changes: 10 additions & 10 deletions Zend/zend_compile.c
Original file line number Diff line number Diff line change
Expand Up @@ -1270,7 +1270,7 @@ static void zend_mark_function_as_generator() /* {{{ */

if (ZEND_TYPE_CODE(return_info.type) != IS_ITERABLE) {
const char *msg = "Generators may only declare a return type of Generator, Iterator, Traversable, or iterable, %s is not permitted";

if (!ZEND_TYPE_IS_CLASS(return_info.type)) {
zend_error_noreturn(E_COMPILE_ERROR, msg, zend_get_type_by_const(ZEND_TYPE_CODE(return_info.type)));
}
Expand Down Expand Up @@ -2174,7 +2174,7 @@ static void zend_emit_tick(void) /* {{{ */
if (CG(active_op_array)->last && CG(active_op_array)->opcodes[CG(active_op_array)->last - 1].opcode == ZEND_TICKS) {
return;
}

opline = get_next_op(CG(active_op_array));

opline->opcode = ZEND_TICKS;
Expand Down Expand Up @@ -2608,7 +2608,7 @@ static zend_op *zend_compile_simple_var_no_cv(znode *result, zend_ast *ast, uint
opline = zend_emit_op(result, ZEND_FETCH_R, &name_node, NULL);
}

if (name_node.op_type == IS_CONST &&
if (name_node.op_type == IS_CONST &&
zend_is_auto_global(Z_STR(name_node.u.constant))) {

opline->extended_value = ZEND_FETCH_GLOBAL;
Expand Down Expand Up @@ -5047,7 +5047,7 @@ void zend_compile_switch(zend_ast *ast) /* {{{ */
if (jumptable) {
zval *cond_zv = zend_ast_get_zval(cond_ast);
zval jmp_target;
ZVAL_LONG(&jmp_target, get_next_op_number(CG(active_op_array)));
ZVAL_LONG(&jmp_target, get_next_op_number(CG(active_op_array)));

ZEND_ASSERT(Z_TYPE_P(cond_zv) == jumptable_type);
if (Z_TYPE_P(cond_zv) == IS_LONG) {
Expand Down Expand Up @@ -5221,7 +5221,7 @@ void zend_compile_try(zend_ast *ast) /* {{{ */
if (finally_ast) {
zend_loop_var discard_exception;
uint32_t opnum_jmp = get_next_op_number(CG(active_op_array)) + 1;

/* Pop FAST_CALL from unwind stack */
zend_stack_del_top(&CG(loop_var_stack));

Expand Down Expand Up @@ -5472,7 +5472,7 @@ void zend_compile_params(zend_ast *ast, zend_ast *return_type_ast) /* {{{ */
uint32_t i;
zend_op_array *op_array = CG(active_op_array);
zend_arg_info *arg_infos;

if (return_type_ast) {
zend_bool allow_null = 0;

Expand Down Expand Up @@ -5616,7 +5616,7 @@ void zend_compile_params(zend_ast *ast, zend_ast *return_type_ast) /* {{{ */
"with a float type can only be float, integer, or NULL");
}
break;

case IS_ITERABLE:
if (Z_TYPE(default_node.u.constant) != IS_ARRAY) {
zend_error_noreturn(E_COMPILE_ERROR, "Default value for parameters "
Expand All @@ -5628,7 +5628,7 @@ void zend_compile_params(zend_ast *ast, zend_ast *return_type_ast) /* {{{ */
zend_error_noreturn(E_COMPILE_ERROR, "Default value for parameters "
"with an object type can only be NULL");
break;

default:
if (!ZEND_SAME_FAKE_TYPE(ZEND_TYPE_CODE(arg_info->type), Z_TYPE(default_node.u.constant))) {
zend_error_noreturn(E_COMPILE_ERROR, "Default value for parameters "
Expand Down Expand Up @@ -5661,7 +5661,7 @@ void zend_compile_params(zend_ast *ast, zend_ast *return_type_ast) /* {{{ */
} else {
opline->op2.num = -1;
}
}
}
}

/* These are assigned at the end to avoid unitialized memory in case of an error */
Expand Down Expand Up @@ -7917,7 +7917,7 @@ static void zend_compile_encaps_list(znode *result, zend_ast *ast) /* {{{ */
i = ((j * sizeof(zend_string*)) + (sizeof(zval) - 1)) / sizeof(zval);
while (i > 1) {
get_temporary_variable(CG(active_op_array));
i--;
i--;
}

zend_end_live_range(CG(active_op_array), range, opline - CG(active_op_array)->opcodes,
Expand Down
16 changes: 8 additions & 8 deletions Zend/zend_execute.c
Original file line number Diff line number Diff line change
Expand Up @@ -576,7 +576,7 @@ static inline zval *_get_zval_ptr_ptr(int op_type, znode_op node, zend_free_op *
}

static zend_always_inline zval *_get_obj_zval_ptr_unused(EXECUTE_DATA_D)
{
{
return &EX(This);
}

Expand Down Expand Up @@ -954,7 +954,7 @@ static ZEND_COLD void zend_verify_return_error(

zend_verify_type_error_common(
zf, arg_info, ce, value,
&fname, &fsep, &fclass, &need_msg, &need_kind, &need_or_null, &given_msg, &given_kind);
&fname, &fsep, &fclass, &need_msg, &need_kind, &need_or_null, &given_msg, &given_kind);

zend_type_error("Return value of %s%s%s() must %s%s%s, %s%s returned",
fclass, fsep, fname, need_msg, need_kind, need_or_null, given_msg, given_kind);
Expand All @@ -970,7 +970,7 @@ static ZEND_COLD void zend_verify_internal_return_error(

zend_verify_type_error_common(
zf, arg_info, ce, value,
&fname, &fsep, &fclass, &need_msg, &need_kind, &need_or_null, &given_msg, &given_kind);
&fname, &fsep, &fclass, &need_msg, &need_kind, &need_or_null, &given_msg, &given_kind);

zend_error_noreturn(E_CORE_ERROR, "Return value of %s%s%s() must %s%s%s, %s%s returned",
fclass, fsep, fname, need_msg, need_kind, need_or_null, given_msg, given_kind);
Expand Down Expand Up @@ -1018,7 +1018,7 @@ static zend_always_inline void zend_verify_return_type(zend_function *zf, zval *
{
zend_arg_info *ret_info = zf->common.arg_info - 1;
zend_class_entry *ce = NULL;

if (UNEXPECTED(!zend_check_type(ret_info->type, ret, &ce, cache_slot, NULL, NULL, 1))) {
zend_verify_return_error(zf, ce, ret);
}
Expand Down Expand Up @@ -1409,7 +1409,7 @@ static zend_never_inline void zend_pre_incdec_overloaded_property(zval *object,

if (Z_OBJ_HT_P(object)->read_property && Z_OBJ_HT_P(object)->write_property) {
zval *z, *zptr, obj;

ZVAL_OBJ(&obj, Z_OBJ_P(object));
Z_ADDREF(obj);
zptr = z = Z_OBJ_HT(obj)->read_property(&obj, property, BP_VAR_R, cache_slot, &rv);
Expand Down Expand Up @@ -1617,7 +1617,7 @@ static zend_always_inline zval *zend_fetch_dimension_address_inner(HashTable *ht
switch (Z_TYPE_P(dim)) {
case IS_UNDEF:
zval_undefined_cv(EX(opline)->op2.var EXECUTE_DATA_CC);
/* break missing intentionally */
/* break missing intentionally */
case IS_NULL:
offset_key = ZSTR_EMPTY_ALLOC();
goto str_index;
Expand Down Expand Up @@ -1996,7 +1996,7 @@ static zend_always_inline void zend_fetch_property_address(zval *result, zval *c
ZVAL_INDIRECT(result, ptr);
}
} else if (EXPECTED(Z_OBJ_HT_P(container)->read_property)) {
goto use_read_property;
goto use_read_property;
} else {
zend_error(E_WARNING, "This object doesn't support property references");
ZVAL_ERROR(result);
Expand Down Expand Up @@ -2446,7 +2446,7 @@ static void cleanup_unfinished_calls(zend_execute_data *execute_data, uint32_t o
zend_op *opline = EX(func)->op_array.opcodes + op_num;
int level;
int do_exit;

if (UNEXPECTED(opline->opcode == ZEND_INIT_FCALL ||
opline->opcode == ZEND_INIT_FCALL_BY_NAME ||
opline->opcode == ZEND_INIT_NS_FCALL_BY_NAME ||
Expand Down
2 changes: 1 addition & 1 deletion Zend/zend_execute_API.c
Original file line number Diff line number Diff line change
Expand Up @@ -785,7 +785,7 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache) /
ZEND_ADD_CALL_FLAG(call, call_info);
}

if (func->type == ZEND_USER_FUNCTION) {
if (func->type == ZEND_USER_FUNCTION) {
int call_via_handler = (func->common.fn_flags & ZEND_ACC_CALL_VIA_TRAMPOLINE) != 0;
const zend_op *current_opline_before_exception = EG(opline_before_exception);

Expand Down
2 changes: 1 addition & 1 deletion Zend/zend_inheritance.c
Original file line number Diff line number Diff line change
Expand Up @@ -1601,7 +1601,7 @@ static void zend_do_traits_property_binding(zend_class_entry *ce) /* {{{ */
flags |= ZEND_ACC_CHANGED;
} else {
not_compatible = 1;

if ((coliding_prop->flags & (ZEND_ACC_PPP_MASK | ZEND_ACC_STATIC))
== (flags & (ZEND_ACC_PPP_MASK | ZEND_ACC_STATIC))) {
/* the flags are identical, thus, the properties may be compatible */
Expand Down
Loading