Skip to content
Merged
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: 2 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,8 @@ PHP NEWS
(ndossche)
. Add array size maximum to array_diff(). (ndossche)
. Add enum SortDirection. (timwolla)
. pathinfo() raises a ValueError with an invalid $flags argument.
(David Carlier)

- Streams:
. Added so_keepalive, tcp_keepidle, tcp_keepintvl and tcp_keepcnt stream
Expand Down
4 changes: 4 additions & 0 deletions UPGRADING
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,10 @@ PHP 8.6 UPGRADE NOTES
when not null, and on failure, gives the error code (one of the EAI_*
constants).

- Standard:
. pathinfo() now raises a ValueError when an invalid $flag argument
value is passed.

- Zip:
. ZipArchive::extractTo now raises a TypeError for the
files argument if one or more of the entries is not
Expand Down
21 changes: 10 additions & 11 deletions Zend/zend_compile.c
Original file line number Diff line number Diff line change
Expand Up @@ -2971,7 +2971,6 @@ static zend_op *zend_compile_simple_var_no_cv(znode *result, const zend_ast *ast

opline->extended_value = ZEND_FETCH_GLOBAL;
} else {
// TODO: Have a test case for this?
if (name_node.op_type == IS_CONST
&& type == BP_VAR_R
&& zend_string_equals_literal(Z_STR(name_node.u.constant), "http_response_header")) {
Expand Down Expand Up @@ -7472,15 +7471,15 @@ static void zend_are_intersection_types_redundant(const zend_type left_type, con

unsigned int sum = 0;
const zend_type *outer_type;
ZEND_TYPE_LIST_FOREACH(smaller_type_list, outer_type)
ZEND_TYPE_LIST_FOREACH(smaller_type_list, outer_type) {
const zend_type *inner_type;
ZEND_TYPE_LIST_FOREACH(larger_type_list, inner_type)
ZEND_TYPE_LIST_FOREACH(larger_type_list, inner_type) {
if (zend_string_equals_ci(ZEND_TYPE_NAME(*inner_type), ZEND_TYPE_NAME(*outer_type))) {
sum++;
break;
}
ZEND_TYPE_LIST_FOREACH_END();
ZEND_TYPE_LIST_FOREACH_END();
} ZEND_TYPE_LIST_FOREACH_END();
} ZEND_TYPE_LIST_FOREACH_END();

if (sum == smaller_type_list->num_types) {
zend_string *smaller_type_str;
Expand Down Expand Up @@ -7508,14 +7507,14 @@ static void zend_is_intersection_type_redundant_by_single_type(const zend_type i
ZEND_ASSERT(!ZEND_TYPE_IS_INTERSECTION(single_type));

const zend_type *single_intersection_type = NULL;
ZEND_TYPE_FOREACH(intersection_type, single_intersection_type)
ZEND_TYPE_FOREACH(intersection_type, single_intersection_type) {
if (zend_string_equals_ci(ZEND_TYPE_NAME(*single_intersection_type), ZEND_TYPE_NAME(single_type))) {
zend_string *single_type_str = zend_type_to_string(single_type);
zend_string *complete_type = zend_type_to_string(intersection_type);
zend_error_noreturn(E_COMPILE_ERROR, "Type %s is redundant as it is more restrictive than type %s",
ZSTR_VAL(complete_type), ZSTR_VAL(single_type_str));
}
ZEND_TYPE_FOREACH_END();
} ZEND_TYPE_FOREACH_END();
}

/* Used by both intersection and union types prior to transforming the type list to a full zend_type */
Expand Down Expand Up @@ -8465,7 +8464,7 @@ static void compile_implicit_lexical_binds(
op_array->static_variables = zend_new_array(8);
}

ZEND_HASH_MAP_FOREACH_STR_KEY(&info->uses, var_name)
ZEND_HASH_MAP_FOREACH_STR_KEY(&info->uses, var_name) {
zval *value = zend_hash_add(
op_array->static_variables, var_name, &EG(uninitialized_zval));
uint32_t offset = (uint32_t)((char*)value - (char*)op_array->static_variables->arData);
Expand All @@ -8474,7 +8473,7 @@ static void compile_implicit_lexical_binds(
opline->op2_type = IS_CV;
opline->op2.var = lookup_cv(var_name);
opline->extended_value = offset | ZEND_BIND_IMPLICIT;
ZEND_HASH_FOREACH_END();
} ZEND_HASH_FOREACH_END();
}

static void zend_compile_closure_uses(zend_ast *ast) /* {{{ */
Expand Down Expand Up @@ -8514,11 +8513,11 @@ static void zend_compile_closure_uses(zend_ast *ast) /* {{{ */
static void zend_compile_implicit_closure_uses(const closure_info *info)
{
zend_string *var_name;
ZEND_HASH_MAP_FOREACH_STR_KEY(&info->uses, var_name)
ZEND_HASH_MAP_FOREACH_STR_KEY(&info->uses, var_name) {
zval zv;
ZVAL_NULL(&zv);
zend_compile_static_var_common(var_name, &zv, ZEND_BIND_IMPLICIT);
ZEND_HASH_FOREACH_END();
} ZEND_HASH_FOREACH_END();
}

static void add_stringable_interface(zend_class_entry *ce) {
Expand Down
6 changes: 4 additions & 2 deletions Zend/zend_execute_API.c
Original file line number Diff line number Diff line change
Expand Up @@ -1025,8 +1025,10 @@ zend_result zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_
if (should_throw) {
zend_internal_call_arginfo_violation(call->func);
}
ZEND_ASSERT(!(call->func->common.fn_flags & ZEND_ACC_HAS_RETURN_TYPE) ||
zend_verify_internal_return_type(call->func, fci->retval));
if (call->func->common.fn_flags & ZEND_ACC_HAS_RETURN_TYPE) {
bool result = zend_verify_internal_return_type(call->func, fci->retval);
ZEND_ASSERT(result);
}
ZEND_ASSERT((call->func->common.fn_flags & ZEND_ACC_RETURN_REFERENCE)
? Z_ISREF_P(fci->retval) : !Z_ISREF_P(fci->retval));
}
Expand Down
24 changes: 16 additions & 8 deletions Zend/zend_vm_def.h
Original file line number Diff line number Diff line change
Expand Up @@ -4154,8 +4154,10 @@ ZEND_VM_HOT_HANDLER(129, ZEND_DO_ICALL, ANY, ANY, SPEC(RETVAL,OBSERVER))
if (should_throw) {
zend_internal_call_arginfo_violation(call->func);
}
ZEND_ASSERT(!(call->func->common.fn_flags & ZEND_ACC_HAS_RETURN_TYPE) ||
zend_verify_internal_return_type(call->func, ret));
if (call->func->common.fn_flags & ZEND_ACC_HAS_RETURN_TYPE) {
bool result = zend_verify_internal_return_type(call->func, ret);
ZEND_ASSERT(result);
}
ZEND_ASSERT((call->func->common.fn_flags & ZEND_ACC_RETURN_REFERENCE)
? Z_ISREF_P(ret) : !Z_ISREF_P(ret));
zend_verify_internal_func_info(call->func, ret);
Expand Down Expand Up @@ -4283,8 +4285,10 @@ ZEND_VM_HOT_HANDLER(131, ZEND_DO_FCALL_BY_NAME, ANY, ANY, SPEC(RETVAL,OBSERVER))
if (should_throw) {
zend_internal_call_arginfo_violation(call->func);
}
ZEND_ASSERT(!(call->func->common.fn_flags & ZEND_ACC_HAS_RETURN_TYPE) ||
zend_verify_internal_return_type(call->func, ret));
if (call->func->common.fn_flags & ZEND_ACC_HAS_RETURN_TYPE) {
bool result = zend_verify_internal_return_type(call->func, ret);
ZEND_ASSERT(result);
}
ZEND_ASSERT((call->func->common.fn_flags & ZEND_ACC_RETURN_REFERENCE)
? Z_ISREF_P(ret) : !Z_ISREF_P(ret));
zend_verify_internal_func_info(call->func, ret);
Expand Down Expand Up @@ -4412,8 +4416,10 @@ ZEND_VM_HOT_HANDLER(60, ZEND_DO_FCALL, ANY, ANY, SPEC(RETVAL,OBSERVER))
if (should_throw) {
zend_internal_call_arginfo_violation(call->func);
}
ZEND_ASSERT(!(call->func->common.fn_flags & ZEND_ACC_HAS_RETURN_TYPE) ||
zend_verify_internal_return_type(call->func, ret));
if (call->func->common.fn_flags & ZEND_ACC_HAS_RETURN_TYPE) {
bool result = zend_verify_internal_return_type(call->func, ret);
ZEND_ASSERT(result);
}
ZEND_ASSERT((call->func->common.fn_flags & ZEND_ACC_RETURN_REFERENCE)
? Z_ISREF_P(ret) : !Z_ISREF_P(ret));
zend_verify_internal_func_info(call->func, ret);
Expand Down Expand Up @@ -9119,8 +9125,10 @@ ZEND_VM_HANDLER(158, ZEND_CALL_TRAMPOLINE, ANY, ANY, SPEC(OBSERVER))
if (should_throw) {
zend_internal_call_arginfo_violation(call->func);
}
ZEND_ASSERT(!(call->func->common.fn_flags & ZEND_ACC_HAS_RETURN_TYPE) ||
zend_verify_internal_return_type(call->func, ret));
if (call->func->common.fn_flags & ZEND_ACC_HAS_RETURN_TYPE) {
bool result = zend_verify_internal_return_type(call->func, ret);
ZEND_ASSERT(result);
}
ZEND_ASSERT((call->func->common.fn_flags & ZEND_ACC_RETURN_REFERENCE)
? Z_ISREF_P(ret) : !Z_ISREF_P(ret));
zend_verify_internal_func_info(call->func, ret);
Expand Down
Loading