mirror of
https://github.com/php/php-src.git
synced 2026-03-24 00:02:20 +01:00
Zend: Use true / false instead of 1 / 0 for bool parameters
Changes done with Coccinelle:
@r1@
identifier F;
identifier p;
typedef bool;
parameter list [n1] PL1;
parameter list [n2] PL2;
@@
F(PL1, bool p, PL2) {
...
}
@r2@
identifier r1.F;
expression list [r1.n1] EL1;
expression list [r1.n2] EL2;
@@
F(EL1,
(
- 1
+ true
|
- 0
+ false
)
, EL2)
This commit is contained in:
committed by
Tim Düsterhus
parent
fb2f7fe70f
commit
c9b175992c
@@ -553,7 +553,7 @@ static void zend_print_zval_r_to_buf(smart_str *buf, zval *expr, int indent) /*
|
||||
}
|
||||
GC_PROTECT_RECURSION(Z_ARRVAL_P(expr));
|
||||
}
|
||||
print_hash(buf, Z_ARRVAL_P(expr), indent, 0);
|
||||
print_hash(buf, Z_ARRVAL_P(expr), indent, false);
|
||||
GC_TRY_UNPROTECT_RECURSION(Z_ARRVAL_P(expr));
|
||||
break;
|
||||
case IS_OBJECT:
|
||||
@@ -583,12 +583,12 @@ static void zend_print_zval_r_to_buf(smart_str *buf, zval *expr, int indent) /*
|
||||
}
|
||||
|
||||
if ((properties = zend_get_properties_for(expr, ZEND_PROP_PURPOSE_DEBUG)) == NULL) {
|
||||
print_hash(buf, (HashTable*) &zend_empty_array, indent, 1);
|
||||
print_hash(buf, (HashTable*) &zend_empty_array, indent, true);
|
||||
break;
|
||||
}
|
||||
|
||||
ZEND_GUARD_OR_GC_PROTECT_RECURSION(guard, DEBUG, zobj);
|
||||
print_hash(buf, properties, indent, 1);
|
||||
print_hash(buf, properties, indent, true);
|
||||
ZEND_GUARD_OR_GC_UNPROTECT_RECURSION(guard, DEBUG, zobj);
|
||||
|
||||
zend_release_properties(properties);
|
||||
|
||||
@@ -4320,7 +4320,7 @@ ZEND_API void zend_fcall_info_args_save(zend_fcall_info *fci, uint32_t *param_co
|
||||
|
||||
ZEND_API void zend_fcall_info_args_restore(zend_fcall_info *fci, uint32_t param_count, zval *params) /* {{{ */
|
||||
{
|
||||
zend_fcall_info_args_clear(fci, 1);
|
||||
zend_fcall_info_args_clear(fci, true);
|
||||
fci->param_count = param_count;
|
||||
fci->params = params;
|
||||
}
|
||||
|
||||
@@ -2139,7 +2139,7 @@ tail_call:
|
||||
case ZEND_AST_CLASS:
|
||||
decl = (const zend_ast_decl *) ast;
|
||||
if (decl->child[3]) {
|
||||
zend_ast_export_attributes(str, decl->child[3], indent, 1);
|
||||
zend_ast_export_attributes(str, decl->child[3], indent, true);
|
||||
}
|
||||
if (decl->flags & ZEND_ACC_INTERFACE) {
|
||||
smart_str_appends(str, "interface ");
|
||||
@@ -2173,11 +2173,11 @@ tail_call:
|
||||
case ZEND_AST_EXPR_LIST:
|
||||
case ZEND_AST_PARAM_LIST:
|
||||
simple_list:
|
||||
zend_ast_export_list(str, zend_ast_get_list(ast), 1, 20, indent);
|
||||
zend_ast_export_list(str, zend_ast_get_list(ast), true, 20, indent);
|
||||
break;
|
||||
case ZEND_AST_ARRAY:
|
||||
smart_str_appendc(str, '[');
|
||||
zend_ast_export_list(str, zend_ast_get_list(ast), 1, 20, indent);
|
||||
zend_ast_export_list(str, zend_ast_get_list(ast), true, 20, indent);
|
||||
smart_str_appendc(str, ']');
|
||||
break;
|
||||
case ZEND_AST_ENCAPS_LIST:
|
||||
@@ -2195,7 +2195,7 @@ simple_list:
|
||||
case ZEND_AST_SWITCH_LIST:
|
||||
case ZEND_AST_CATCH_LIST:
|
||||
case ZEND_AST_MATCH_ARM_LIST:
|
||||
zend_ast_export_list(str, zend_ast_get_list(ast), 0, 0, indent);
|
||||
zend_ast_export_list(str, zend_ast_get_list(ast), false, 0, indent);
|
||||
break;
|
||||
case ZEND_AST_CLOSURE_USES:
|
||||
smart_str_appends(str, " use(");
|
||||
@@ -2207,7 +2207,7 @@ simple_list:
|
||||
zend_ast *prop_ast = ast->child[1];
|
||||
|
||||
if (ast->child[2]) {
|
||||
zend_ast_export_attributes(str, ast->child[2], indent, 1);
|
||||
zend_ast_export_attributes(str, ast->child[2], indent, true);
|
||||
}
|
||||
|
||||
zend_ast_export_visibility(str, ast->attr, ZEND_MODIFIER_TARGET_PROPERTY);
|
||||
@@ -2236,13 +2236,13 @@ simple_list:
|
||||
str,
|
||||
ast_list->child[ast_list->children - 1],
|
||||
indent,
|
||||
1
|
||||
true
|
||||
);
|
||||
/* So that the list printing doesn't try to print the attributes,
|
||||
* use zend_ast_export_list_ex() to override the number of children
|
||||
* to print. */
|
||||
smart_str_appends(str, "const ");
|
||||
zend_ast_export_list_ex(str, ast_list, 1, 20, indent, ast_list->children - 1);
|
||||
zend_ast_export_list_ex(str, ast_list, true, 20, indent, ast_list->children - 1);
|
||||
break;
|
||||
}
|
||||
smart_str_appends(str, "const ");
|
||||
@@ -2250,7 +2250,7 @@ simple_list:
|
||||
}
|
||||
case ZEND_AST_CLASS_CONST_GROUP:
|
||||
if (ast->child[1]) {
|
||||
zend_ast_export_attributes(str, ast->child[1], indent, 1);
|
||||
zend_ast_export_attributes(str, ast->child[1], indent, true);
|
||||
}
|
||||
|
||||
zend_ast_export_visibility(str, ast->attr, ZEND_MODIFIER_TARGET_CONSTANT);
|
||||
@@ -2534,7 +2534,7 @@ simple_list:
|
||||
if (ast->child[0]->kind == ZEND_AST_CLASS) {
|
||||
const zend_ast_decl *decl = (const zend_ast_decl *) ast->child[0];
|
||||
if (decl->child[3]) {
|
||||
zend_ast_export_attributes(str, decl->child[3], indent, 0);
|
||||
zend_ast_export_attributes(str, decl->child[3], indent, false);
|
||||
}
|
||||
smart_str_appends(str, "class");
|
||||
if (!zend_ast_is_list(ast->child[1])
|
||||
@@ -2635,7 +2635,7 @@ simple_list:
|
||||
case ZEND_AST_MATCH_ARM:
|
||||
zend_ast_export_indent(str, indent);
|
||||
if (ast->child[0]) {
|
||||
zend_ast_export_list(str, zend_ast_get_list(ast->child[0]), 1, 0, indent);
|
||||
zend_ast_export_list(str, zend_ast_get_list(ast->child[0]), true, 0, indent);
|
||||
smart_str_appends(str, " => ");
|
||||
} else {
|
||||
smart_str_appends(str, "default => ");
|
||||
@@ -2646,7 +2646,7 @@ simple_list:
|
||||
case ZEND_AST_DECLARE:
|
||||
smart_str_appends(str, "declare(");
|
||||
ZEND_ASSERT(ast->child[0]->kind == ZEND_AST_CONST_DECL);
|
||||
zend_ast_export_list(str, zend_ast_get_list(ast->child[0]), 1, 0, indent);
|
||||
zend_ast_export_list(str, zend_ast_get_list(ast->child[0]), true, 0, indent);
|
||||
smart_str_appendc(str, ')');
|
||||
if (ast->child[1]) {
|
||||
smart_str_appends(str, " {\n");
|
||||
@@ -2793,7 +2793,7 @@ simple_list:
|
||||
break;
|
||||
case ZEND_AST_PARAM:
|
||||
if (ast->child[3]) {
|
||||
zend_ast_export_attributes(str, ast->child[3], indent, 0);
|
||||
zend_ast_export_attributes(str, ast->child[3], indent, false);
|
||||
}
|
||||
zend_ast_export_visibility(str, ast->attr, ZEND_MODIFIER_TARGET_CPP);
|
||||
if (ast->attr & ZEND_ACC_FINAL) {
|
||||
@@ -2821,7 +2821,7 @@ simple_list:
|
||||
break;
|
||||
case ZEND_AST_ENUM_CASE:
|
||||
if (ast->child[3]) {
|
||||
zend_ast_export_attributes(str, ast->child[3], indent, 1);
|
||||
zend_ast_export_attributes(str, ast->child[3], indent, true);
|
||||
}
|
||||
smart_str_appends(str, "case ");
|
||||
zend_ast_export_name(str, ast->child[0], 0, indent);
|
||||
|
||||
@@ -824,8 +824,8 @@ ZEND_FUNCTION(get_class_vars)
|
||||
}
|
||||
|
||||
scope = zend_get_executed_scope();
|
||||
add_class_vars(scope, ce, 0, return_value);
|
||||
add_class_vars(scope, ce, 1, return_value);
|
||||
add_class_vars(scope, ce, false, return_value);
|
||||
add_class_vars(scope, ce, true, return_value);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
||||
@@ -1131,13 +1131,13 @@ static zend_string *zend_resolve_non_class_name(
|
||||
static zend_string *zend_resolve_function_name(zend_string *name, uint32_t type, bool *is_fully_qualified)
|
||||
{
|
||||
return zend_resolve_non_class_name(
|
||||
name, type, is_fully_qualified, 0, FC(imports_function));
|
||||
name, type, is_fully_qualified, false, FC(imports_function));
|
||||
}
|
||||
|
||||
static zend_string *zend_resolve_const_name(zend_string *name, uint32_t type, bool *is_fully_qualified)
|
||||
{
|
||||
return zend_resolve_non_class_name(
|
||||
name, type, is_fully_qualified, 1, FC(imports_const));
|
||||
name, type, is_fully_qualified, true, FC(imports_const));
|
||||
}
|
||||
|
||||
static zend_string *zend_resolve_class_name(zend_string *name, uint32_t type) /* {{{ */
|
||||
@@ -1287,7 +1287,7 @@ ZEND_API zend_result do_bind_function(zend_function *func, zval *lcname) /* {{{
|
||||
{
|
||||
zend_function *added_func = zend_hash_add_ptr(EG(function_table), Z_STR_P(lcname), func);
|
||||
if (UNEXPECTED(!added_func)) {
|
||||
do_bind_function_error(Z_STR_P(lcname), &func->op_array, 0);
|
||||
do_bind_function_error(Z_STR_P(lcname), &func->op_array, false);
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
@@ -2697,7 +2697,7 @@ void zend_emit_final_return(bool return_one) /* {{{ */
|
||||
return;
|
||||
}
|
||||
|
||||
zend_emit_return_type_check(NULL, return_info, 1);
|
||||
zend_emit_return_type_check(NULL, return_info, true);
|
||||
}
|
||||
|
||||
zn.op_type = IS_CONST;
|
||||
@@ -3069,7 +3069,7 @@ static zend_op *zend_delayed_compile_dim(znode *result, zend_ast *ast, uint32_t
|
||||
return opline;
|
||||
} else {
|
||||
zend_short_circuiting_mark_inner(var_ast);
|
||||
opline = zend_delayed_compile_var(&var_node, var_ast, type, 0);
|
||||
opline = zend_delayed_compile_var(&var_node, var_ast, type, false);
|
||||
if (opline) {
|
||||
if (type == BP_VAR_W && (opline->opcode == ZEND_FETCH_STATIC_PROP_W || opline->opcode == ZEND_FETCH_OBJ_W)) {
|
||||
opline->extended_value |= ZEND_FETCH_DIM_WRITE;
|
||||
@@ -3137,7 +3137,7 @@ static zend_op *zend_delayed_compile_prop(znode *result, zend_ast *ast, uint32_t
|
||||
* check for a nullsafe access. */
|
||||
} else {
|
||||
zend_short_circuiting_mark_inner(obj_ast);
|
||||
opline = zend_delayed_compile_var(&obj_node, obj_ast, type, 0);
|
||||
opline = zend_delayed_compile_var(&obj_node, obj_ast, type, false);
|
||||
if (opline && (opline->opcode == ZEND_FETCH_DIM_W
|
||||
|| opline->opcode == ZEND_FETCH_DIM_RW
|
||||
|| opline->opcode == ZEND_FETCH_DIM_FUNC_ARG
|
||||
@@ -3437,7 +3437,7 @@ static void zend_compile_expr_with_potential_assign_to_self(
|
||||
znode cv_node;
|
||||
|
||||
if (zend_try_compile_cv(&cv_node, expr_ast, BP_VAR_R) == FAILURE) {
|
||||
zend_compile_simple_var_no_cv(expr_node, expr_ast, BP_VAR_R, 0);
|
||||
zend_compile_simple_var_no_cv(expr_node, expr_ast, BP_VAR_R, false);
|
||||
} else {
|
||||
zend_emit_op_tmp(expr_node, ZEND_QM_ASSIGN, &cv_node, NULL);
|
||||
}
|
||||
@@ -3465,7 +3465,7 @@ static void zend_compile_assign(znode *result, zend_ast *ast) /* {{{ */
|
||||
switch (kind) {
|
||||
case ZEND_AST_VAR:
|
||||
offset = zend_delayed_compile_begin();
|
||||
zend_delayed_compile_var(&var_node, var_ast, BP_VAR_W, 0);
|
||||
zend_delayed_compile_var(&var_node, var_ast, BP_VAR_W, false);
|
||||
zend_compile_expr(&expr_node, expr_ast);
|
||||
zend_delayed_compile_end(offset);
|
||||
CG(zend_lineno) = zend_ast_get_lineno(var_ast);
|
||||
@@ -3473,7 +3473,7 @@ static void zend_compile_assign(znode *result, zend_ast *ast) /* {{{ */
|
||||
return;
|
||||
case ZEND_AST_STATIC_PROP:
|
||||
offset = zend_delayed_compile_begin();
|
||||
zend_delayed_compile_var(result, var_ast, BP_VAR_W, 0);
|
||||
zend_delayed_compile_var(result, var_ast, BP_VAR_W, false);
|
||||
zend_compile_expr(&expr_node, expr_ast);
|
||||
|
||||
opline = zend_delayed_compile_end(offset);
|
||||
@@ -3517,7 +3517,7 @@ static void zend_compile_assign(znode *result, zend_ast *ast) /* {{{ */
|
||||
zend_assert_not_short_circuited(expr_ast);
|
||||
}
|
||||
|
||||
zend_compile_var(&expr_node, expr_ast, BP_VAR_W, 1);
|
||||
zend_compile_var(&expr_node, expr_ast, BP_VAR_W, true);
|
||||
/* MAKE_REF is usually not necessary for CVs. However, if there are
|
||||
* self-assignments, this forces the RHS to evaluate first. */
|
||||
zend_emit_op(&expr_node, ZEND_MAKE_REF, &expr_node, NULL);
|
||||
@@ -3527,7 +3527,7 @@ static void zend_compile_assign(znode *result, zend_ast *ast) /* {{{ */
|
||||
znode cv_node;
|
||||
|
||||
if (zend_try_compile_cv(&cv_node, expr_ast, BP_VAR_R) == FAILURE) {
|
||||
zend_compile_simple_var_no_cv(&expr_node, expr_ast, BP_VAR_R, 0);
|
||||
zend_compile_simple_var_no_cv(&expr_node, expr_ast, BP_VAR_R, false);
|
||||
} else {
|
||||
zend_emit_op_tmp(&expr_node, ZEND_QM_ASSIGN, &cv_node, NULL);
|
||||
}
|
||||
@@ -3562,8 +3562,8 @@ static void zend_compile_assign_ref(znode *result, zend_ast *ast) /* {{{ */
|
||||
}
|
||||
|
||||
offset = zend_delayed_compile_begin();
|
||||
zend_delayed_compile_var(&target_node, target_ast, BP_VAR_W, 1);
|
||||
zend_compile_var(&source_node, source_ast, BP_VAR_W, 1);
|
||||
zend_delayed_compile_var(&target_node, target_ast, BP_VAR_W, true);
|
||||
zend_compile_var(&source_node, source_ast, BP_VAR_W, true);
|
||||
|
||||
if ((target_ast->kind != ZEND_AST_VAR
|
||||
|| target_ast->child[0]->kind != ZEND_AST_ZVAL)
|
||||
@@ -3632,7 +3632,7 @@ static void zend_compile_compound_assign(znode *result, zend_ast *ast) /* {{{ */
|
||||
switch (kind) {
|
||||
case ZEND_AST_VAR:
|
||||
offset = zend_delayed_compile_begin();
|
||||
zend_delayed_compile_var(&var_node, var_ast, BP_VAR_RW, 0);
|
||||
zend_delayed_compile_var(&var_node, var_ast, BP_VAR_RW, false);
|
||||
zend_compile_expr(&expr_node, expr_ast);
|
||||
zend_delayed_compile_end(offset);
|
||||
opline = zend_emit_op_tmp(result, ZEND_ASSIGN_OP, &var_node, &expr_node);
|
||||
@@ -3640,7 +3640,7 @@ static void zend_compile_compound_assign(znode *result, zend_ast *ast) /* {{{ */
|
||||
return;
|
||||
case ZEND_AST_STATIC_PROP:
|
||||
offset = zend_delayed_compile_begin();
|
||||
zend_delayed_compile_var(result, var_ast, BP_VAR_RW, 0);
|
||||
zend_delayed_compile_var(result, var_ast, BP_VAR_RW, false);
|
||||
zend_compile_expr(&expr_node, expr_ast);
|
||||
|
||||
opline = zend_delayed_compile_end(offset);
|
||||
@@ -3799,7 +3799,7 @@ static uint32_t zend_compile_args(
|
||||
/* Treat passing of $GLOBALS the same as passing a call.
|
||||
* This will error at runtime if the argument is by-ref. */
|
||||
if (zend_is_call(arg) || is_globals_fetch(arg)) {
|
||||
zend_compile_var(&arg_node, arg, BP_VAR_R, 0);
|
||||
zend_compile_var(&arg_node, arg, BP_VAR_R, false);
|
||||
if (arg_node.op_type & (IS_CONST|IS_TMP_VAR)) {
|
||||
/* Function call was converted into builtin instruction */
|
||||
if (!fbc || ARG_MUST_BE_SENT_BY_REF(fbc, arg_num)) {
|
||||
@@ -3826,10 +3826,10 @@ static uint32_t zend_compile_args(
|
||||
} else if (zend_is_variable(arg) && !zend_ast_is_short_circuited(arg)) {
|
||||
if (fbc && arg_num != (uint32_t) -1) {
|
||||
if (ARG_SHOULD_BE_SENT_BY_REF(fbc, arg_num)) {
|
||||
zend_compile_var(&arg_node, arg, BP_VAR_W, 1);
|
||||
zend_compile_var(&arg_node, arg, BP_VAR_W, true);
|
||||
opcode = ZEND_SEND_REF;
|
||||
} else {
|
||||
zend_compile_var(&arg_node, arg, BP_VAR_R, 0);
|
||||
zend_compile_var(&arg_node, arg, BP_VAR_R, false);
|
||||
opcode = (arg_node.op_type == IS_TMP_VAR) ? ZEND_SEND_VAL : ZEND_SEND_VAR;
|
||||
}
|
||||
} else {
|
||||
@@ -3855,7 +3855,7 @@ static uint32_t zend_compile_args(
|
||||
} else {
|
||||
opline->op2.num = arg_num;
|
||||
}
|
||||
zend_compile_var(&arg_node, arg, BP_VAR_FUNC_ARG, 1);
|
||||
zend_compile_var(&arg_node, arg, BP_VAR_FUNC_ARG, true);
|
||||
opcode = ZEND_SEND_FUNC_ARG;
|
||||
} while (0);
|
||||
}
|
||||
@@ -4149,7 +4149,7 @@ static zend_result zend_compile_func_defined(znode *result, zend_ast_list *args)
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
if (zend_try_ct_eval_const(&result->u.constant, name, 0)) {
|
||||
if (zend_try_ct_eval_const(&result->u.constant, name, false)) {
|
||||
zend_string_release_ex(name, 0);
|
||||
zval_ptr_dtor(&result->u.constant);
|
||||
ZVAL_TRUE(&result->u.constant);
|
||||
@@ -5414,7 +5414,7 @@ static void zend_compile_new(znode *result, zend_ast *ast) /* {{{ */
|
||||
|
||||
if (class_ast->kind == ZEND_AST_CLASS) {
|
||||
/* anon class declaration */
|
||||
zend_compile_class_decl(&class_node, class_ast, 0);
|
||||
zend_compile_class_decl(&class_node, class_ast, false);
|
||||
} else {
|
||||
zend_compile_class_ref(&class_node, class_ast, ZEND_FETCH_CLASS_EXCEPTION);
|
||||
}
|
||||
@@ -5579,7 +5579,7 @@ static void zend_compile_unset(zend_ast *ast) /* {{{ */
|
||||
} else if (zend_try_compile_cv(&var_node, var_ast, BP_VAR_UNSET) == SUCCESS) {
|
||||
opline = zend_emit_op(NULL, ZEND_UNSET_CV, &var_node, NULL);
|
||||
} else {
|
||||
opline = zend_compile_simple_var_no_cv(NULL, var_ast, BP_VAR_UNSET, 0);
|
||||
opline = zend_compile_simple_var_no_cv(NULL, var_ast, BP_VAR_UNSET, false);
|
||||
opline->opcode = ZEND_UNSET_VAR;
|
||||
}
|
||||
return;
|
||||
@@ -5589,11 +5589,11 @@ static void zend_compile_unset(zend_ast *ast) /* {{{ */
|
||||
return;
|
||||
case ZEND_AST_PROP:
|
||||
case ZEND_AST_NULLSAFE_PROP:
|
||||
opline = zend_compile_prop(NULL, var_ast, BP_VAR_UNSET, 0);
|
||||
opline = zend_compile_prop(NULL, var_ast, BP_VAR_UNSET, false);
|
||||
opline->opcode = ZEND_UNSET_OBJ;
|
||||
return;
|
||||
case ZEND_AST_STATIC_PROP:
|
||||
opline = zend_compile_static_prop(NULL, var_ast, BP_VAR_UNSET, 0, 0);
|
||||
opline = zend_compile_static_prop(NULL, var_ast, BP_VAR_UNSET, false, false);
|
||||
opline->opcode = ZEND_UNSET_STATIC_PROP;
|
||||
return;
|
||||
EMPTY_SWITCH_DEFAULT_CASE()
|
||||
@@ -5707,7 +5707,7 @@ static void zend_compile_return(zend_ast *ast) /* {{{ */
|
||||
ZVAL_NULL(&expr_node.u.constant);
|
||||
} else if (by_ref && zend_is_variable(expr_ast)) {
|
||||
zend_assert_not_short_circuited(expr_ast);
|
||||
zend_compile_var(&expr_node, expr_ast, BP_VAR_W, 1);
|
||||
zend_compile_var(&expr_node, expr_ast, BP_VAR_W, true);
|
||||
} else {
|
||||
zend_compile_expr(&expr_node, expr_ast);
|
||||
}
|
||||
@@ -5726,7 +5726,7 @@ static void zend_compile_return(zend_ast *ast) /* {{{ */
|
||||
/* Generator return types are handled separately */
|
||||
if (!is_generator && (CG(active_op_array)->fn_flags & ZEND_ACC_HAS_RETURN_TYPE)) {
|
||||
zend_emit_return_type_check(
|
||||
expr_ast ? &expr_node : NULL, CG(active_op_array)->arg_info - 1, 0);
|
||||
expr_ast ? &expr_node : NULL, CG(active_op_array)->arg_info - 1, false);
|
||||
}
|
||||
|
||||
uint32_t opnum_before_finally = get_next_op_number();
|
||||
@@ -5740,7 +5740,7 @@ static void zend_compile_return(zend_ast *ast) /* {{{ */
|
||||
&& !is_generator
|
||||
&& (CG(active_op_array)->fn_flags & ZEND_ACC_HAS_RETURN_TYPE)) {
|
||||
zend_emit_return_type_check(
|
||||
expr_ast ? &expr_node : NULL, CG(active_op_array)->arg_info - 1, 0);
|
||||
expr_ast ? &expr_node : NULL, CG(active_op_array)->arg_info - 1, false);
|
||||
}
|
||||
|
||||
opline = zend_emit_op(NULL, by_ref ? ZEND_RETURN_BY_REF : ZEND_RETURN,
|
||||
@@ -5989,7 +5989,7 @@ static void zend_compile_while(zend_ast *ast) /* {{{ */
|
||||
|
||||
opnum_jmp = zend_emit_jump(0);
|
||||
|
||||
zend_begin_loop(ZEND_NOP, NULL, 0);
|
||||
zend_begin_loop(ZEND_NOP, NULL, false);
|
||||
|
||||
opnum_start = get_next_op_number();
|
||||
zend_compile_stmt(stmt_ast);
|
||||
@@ -6012,7 +6012,7 @@ static void zend_compile_do_while(zend_ast *ast) /* {{{ */
|
||||
znode cond_node;
|
||||
uint32_t opnum_start, opnum_cond;
|
||||
|
||||
zend_begin_loop(ZEND_NOP, NULL, 0);
|
||||
zend_begin_loop(ZEND_NOP, NULL, false);
|
||||
|
||||
opnum_start = get_next_op_number();
|
||||
zend_compile_stmt(stmt_ast);
|
||||
@@ -6069,7 +6069,7 @@ static void zend_compile_for(zend_ast *ast) /* {{{ */
|
||||
|
||||
opnum_jmp = zend_emit_jump(0);
|
||||
|
||||
zend_begin_loop(ZEND_NOP, NULL, 0);
|
||||
zend_begin_loop(ZEND_NOP, NULL, false);
|
||||
|
||||
opnum_start = get_next_op_number();
|
||||
zend_compile_stmt(stmt_ast);
|
||||
@@ -6119,7 +6119,7 @@ static void zend_compile_foreach(zend_ast *ast) /* {{{ */
|
||||
}
|
||||
|
||||
if (by_ref && is_variable) {
|
||||
zend_compile_var(&expr_node, expr_ast, BP_VAR_W, 1);
|
||||
zend_compile_var(&expr_node, expr_ast, BP_VAR_W, true);
|
||||
} else {
|
||||
zend_compile_expr(&expr_node, expr_ast);
|
||||
}
|
||||
@@ -6131,7 +6131,7 @@ static void zend_compile_foreach(zend_ast *ast) /* {{{ */
|
||||
opnum_reset = get_next_op_number();
|
||||
opline = zend_emit_op(&reset_node, by_ref ? ZEND_FE_RESET_RW : ZEND_FE_RESET_R, &expr_node, NULL);
|
||||
|
||||
zend_begin_loop(ZEND_FE_FREE, &reset_node, 0);
|
||||
zend_begin_loop(ZEND_FE_FREE, &reset_node, false);
|
||||
|
||||
opnum_fetch = get_next_op_number();
|
||||
opline = zend_emit_op(NULL, by_ref ? ZEND_FE_FETCH_RW : ZEND_FE_FETCH_R, &reset_node, NULL);
|
||||
@@ -6304,7 +6304,7 @@ static void zend_compile_switch(zend_ast *ast) /* {{{ */
|
||||
|
||||
zend_compile_expr(&expr_node, expr_ast);
|
||||
|
||||
zend_begin_loop(ZEND_FREE, &expr_node, 1);
|
||||
zend_begin_loop(ZEND_FREE, &expr_node, true);
|
||||
|
||||
case_node.op_type = IS_TMP_VAR;
|
||||
case_node.u.op.var = get_temporary_variable();
|
||||
@@ -7001,7 +7001,7 @@ static void zend_compile_declare(zend_ast *ast) /* {{{ */
|
||||
zval_ptr_dtor_nogc(&value_zv);
|
||||
} else if (zend_string_equals_literal_ci(name, "encoding")) {
|
||||
|
||||
if (FAILURE == zend_is_first_statement(ast, /* allow_nop */ 0)) {
|
||||
if (FAILURE == zend_is_first_statement(ast, /* allow_nop */ false)) {
|
||||
zend_error_noreturn(E_COMPILE_ERROR, "Encoding declaration pragma must be "
|
||||
"the very first statement in the script");
|
||||
}
|
||||
@@ -8611,7 +8611,7 @@ static zend_op_array *zend_compile_func_decl_ex(
|
||||
CG(zend_lineno) = decl->end_lineno;
|
||||
|
||||
zend_do_extended_stmt(NULL);
|
||||
zend_emit_final_return(0);
|
||||
zend_emit_final_return(false);
|
||||
|
||||
pass_two(CG(active_op_array));
|
||||
zend_oparray_context_end(&orig_oparray_context);
|
||||
@@ -9292,7 +9292,7 @@ static void zend_compile_class_decl(znode *result, zend_ast *ast, bool toplevel)
|
||||
|
||||
ce->type = ZEND_USER_CLASS;
|
||||
ce->name = name;
|
||||
zend_initialize_class_data(ce, 1);
|
||||
zend_initialize_class_data(ce, true);
|
||||
if (!(decl->flags & ZEND_ACC_ANON_CLASS)) {
|
||||
zend_alloc_ce_cache(ce->name);
|
||||
}
|
||||
@@ -9771,7 +9771,7 @@ static void zend_compile_namespace(zend_ast *ast) /* {{{ */
|
||||
|
||||
bool is_first_namespace = (!with_bracket && !FC(current_namespace))
|
||||
|| (with_bracket && !FC(has_bracketed_namespaces));
|
||||
if (is_first_namespace && FAILURE == zend_is_first_statement(ast, /* allow_nop */ 1)) {
|
||||
if (is_first_namespace && FAILURE == zend_is_first_statement(ast, /* allow_nop */ true)) {
|
||||
zend_error_noreturn(E_COMPILE_ERROR, "Namespace declaration statement has to be "
|
||||
"the very first statement or after any declare call in the script");
|
||||
}
|
||||
@@ -9821,7 +9821,7 @@ static void zend_compile_halt_compiler(zend_ast *ast) /* {{{ */
|
||||
|
||||
filename = zend_get_compiled_filename();
|
||||
name = zend_mangle_property_name(const_name, sizeof(const_name) - 1,
|
||||
ZSTR_VAL(filename), ZSTR_LEN(filename), 0);
|
||||
ZSTR_VAL(filename), ZSTR_LEN(filename), false);
|
||||
|
||||
/* Avoid repeated declaration of the __COMPILER_HALT_OFFSET__ constant in
|
||||
* case this file was already included. */
|
||||
@@ -10412,16 +10412,16 @@ static void zend_compile_post_incdec(znode *result, zend_ast *ast) /* {{{ */
|
||||
zend_ensure_writable_variable(var_ast);
|
||||
|
||||
if (var_ast->kind == ZEND_AST_PROP || var_ast->kind == ZEND_AST_NULLSAFE_PROP) {
|
||||
zend_op *opline = zend_compile_prop(NULL, var_ast, BP_VAR_RW, 0);
|
||||
zend_op *opline = zend_compile_prop(NULL, var_ast, BP_VAR_RW, false);
|
||||
opline->opcode = ast->kind == ZEND_AST_POST_INC ? ZEND_POST_INC_OBJ : ZEND_POST_DEC_OBJ;
|
||||
zend_make_tmp_result(result, opline);
|
||||
} else if (var_ast->kind == ZEND_AST_STATIC_PROP) {
|
||||
zend_op *opline = zend_compile_static_prop(NULL, var_ast, BP_VAR_RW, 0, 0);
|
||||
zend_op *opline = zend_compile_static_prop(NULL, var_ast, BP_VAR_RW, false, false);
|
||||
opline->opcode = ast->kind == ZEND_AST_POST_INC ? ZEND_POST_INC_STATIC_PROP : ZEND_POST_DEC_STATIC_PROP;
|
||||
zend_make_tmp_result(result, opline);
|
||||
} else {
|
||||
znode var_node;
|
||||
zend_op *opline = zend_compile_var(&var_node, var_ast, BP_VAR_RW, 0);
|
||||
zend_op *opline = zend_compile_var(&var_node, var_ast, BP_VAR_RW, false);
|
||||
if (opline && opline->opcode == ZEND_FETCH_DIM_RW) {
|
||||
opline->extended_value = ZEND_FETCH_DIM_INCDEC;
|
||||
}
|
||||
@@ -10439,18 +10439,18 @@ static void zend_compile_pre_incdec(znode *result, zend_ast *ast) /* {{{ */
|
||||
zend_ensure_writable_variable(var_ast);
|
||||
|
||||
if (var_ast->kind == ZEND_AST_PROP || var_ast->kind == ZEND_AST_NULLSAFE_PROP) {
|
||||
zend_op *opline = zend_compile_prop(result, var_ast, BP_VAR_RW, 0);
|
||||
zend_op *opline = zend_compile_prop(result, var_ast, BP_VAR_RW, false);
|
||||
opline->opcode = ast->kind == ZEND_AST_PRE_INC ? ZEND_PRE_INC_OBJ : ZEND_PRE_DEC_OBJ;
|
||||
opline->result_type = IS_TMP_VAR;
|
||||
result->op_type = IS_TMP_VAR;
|
||||
} else if (var_ast->kind == ZEND_AST_STATIC_PROP) {
|
||||
zend_op *opline = zend_compile_static_prop(result, var_ast, BP_VAR_RW, 0, 0);
|
||||
zend_op *opline = zend_compile_static_prop(result, var_ast, BP_VAR_RW, false, false);
|
||||
opline->opcode = ast->kind == ZEND_AST_PRE_INC ? ZEND_PRE_INC_STATIC_PROP : ZEND_PRE_DEC_STATIC_PROP;
|
||||
opline->result_type = IS_TMP_VAR;
|
||||
result->op_type = IS_TMP_VAR;
|
||||
} else {
|
||||
znode var_node;
|
||||
zend_op *opline = zend_compile_var(&var_node, var_ast, BP_VAR_RW, 0);
|
||||
zend_op *opline = zend_compile_var(&var_node, var_ast, BP_VAR_RW, false);
|
||||
if (opline && opline->opcode == ZEND_FETCH_DIM_RW) {
|
||||
opline->extended_value = ZEND_FETCH_DIM_INCDEC;
|
||||
}
|
||||
@@ -10573,7 +10573,7 @@ static void zend_compile_coalesce(znode *result, zend_ast *ast) /* {{{ */
|
||||
zend_op *opline;
|
||||
uint32_t opnum;
|
||||
|
||||
zend_compile_var(&expr_node, expr_ast, BP_VAR_IS, 0);
|
||||
zend_compile_var(&expr_node, expr_ast, BP_VAR_IS, false);
|
||||
|
||||
opnum = get_next_op_number();
|
||||
zend_emit_op_tmp(result, ZEND_COALESCE, &expr_node, NULL);
|
||||
@@ -10620,7 +10620,7 @@ static void zend_compile_assign_coalesce(znode *result, zend_ast *ast) /* {{{ */
|
||||
zend_hash_init(CG(memoized_exprs), 0, NULL, znode_dtor, 0);
|
||||
|
||||
CG(memoize_mode) = ZEND_MEMOIZE_COMPILE;
|
||||
zend_compile_var(&var_node_is, var_ast, BP_VAR_IS, 0);
|
||||
zend_compile_var(&var_node_is, var_ast, BP_VAR_IS, false);
|
||||
|
||||
coalesce_opnum = get_next_op_number();
|
||||
zend_emit_op_tmp(result, ZEND_COALESCE, &var_node_is, NULL);
|
||||
@@ -10633,7 +10633,7 @@ static void zend_compile_assign_coalesce(znode *result, zend_ast *ast) /* {{{ */
|
||||
}
|
||||
|
||||
CG(memoize_mode) = ZEND_MEMOIZE_FETCH;
|
||||
zend_compile_var(&var_node_w, var_ast, BP_VAR_W, 0);
|
||||
zend_compile_var(&var_node_w, var_ast, BP_VAR_W, false);
|
||||
|
||||
/* Reproduce some of the zend_compile_assign() opcode fixup logic here. */
|
||||
opline = &CG(active_op_array)->opcodes[CG(active_op_array)->last-1];
|
||||
@@ -10735,7 +10735,7 @@ static void zend_compile_yield(znode *result, zend_ast *ast) /* {{{ */
|
||||
if (value_ast) {
|
||||
if (returns_by_ref && zend_is_variable(value_ast)) {
|
||||
zend_assert_not_short_circuited(value_ast);
|
||||
zend_compile_var(&value_node, value_ast, BP_VAR_W, 1);
|
||||
zend_compile_var(&value_node, value_ast, BP_VAR_W, true);
|
||||
} else {
|
||||
zend_compile_expr(&value_node, value_ast);
|
||||
}
|
||||
@@ -10868,7 +10868,7 @@ static void zend_compile_isset_or_empty(znode *result, zend_ast *ast) /* {{{ */
|
||||
} else if (zend_try_compile_cv(&var_node, var_ast, BP_VAR_IS) == SUCCESS) {
|
||||
opline = zend_emit_op(result, ZEND_ISSET_ISEMPTY_CV, &var_node, NULL);
|
||||
} else {
|
||||
opline = zend_compile_simple_var_no_cv(result, var_ast, BP_VAR_IS, 0);
|
||||
opline = zend_compile_simple_var_no_cv(result, var_ast, BP_VAR_IS, false);
|
||||
opline->opcode = ZEND_ISSET_ISEMPTY_VAR;
|
||||
}
|
||||
break;
|
||||
@@ -10878,11 +10878,11 @@ static void zend_compile_isset_or_empty(znode *result, zend_ast *ast) /* {{{ */
|
||||
break;
|
||||
case ZEND_AST_PROP:
|
||||
case ZEND_AST_NULLSAFE_PROP:
|
||||
opline = zend_compile_prop(result, var_ast, BP_VAR_IS, 0);
|
||||
opline = zend_compile_prop(result, var_ast, BP_VAR_IS, false);
|
||||
opline->opcode = ZEND_ISSET_ISEMPTY_PROP_OBJ;
|
||||
break;
|
||||
case ZEND_AST_STATIC_PROP:
|
||||
opline = zend_compile_static_prop(result, var_ast, BP_VAR_IS, 0, 0);
|
||||
opline = zend_compile_static_prop(result, var_ast, BP_VAR_IS, false, false);
|
||||
opline->opcode = ZEND_ISSET_ISEMPTY_STATIC_PROP;
|
||||
break;
|
||||
EMPTY_SWITCH_DEFAULT_CASE()
|
||||
@@ -10905,7 +10905,7 @@ static void zend_compile_silence(znode *result, zend_ast *ast) /* {{{ */
|
||||
if (expr_ast->kind == ZEND_AST_VAR) {
|
||||
/* For @$var we need to force a FETCH instruction, otherwise the CV access will
|
||||
* happen outside the silenced section. */
|
||||
zend_compile_simple_var_no_cv(result, expr_ast, BP_VAR_R, 0 );
|
||||
zend_compile_simple_var_no_cv(result, expr_ast, BP_VAR_R, false );
|
||||
} else {
|
||||
zend_compile_expr(result, expr_ast);
|
||||
}
|
||||
@@ -10983,7 +10983,7 @@ static void zend_compile_array(znode *result, zend_ast *ast) /* {{{ */
|
||||
|
||||
if (by_ref) {
|
||||
zend_ensure_writable_variable(value_ast);
|
||||
zend_compile_var(&value_node, value_ast, BP_VAR_W, 1);
|
||||
zend_compile_var(&value_node, value_ast, BP_VAR_W, true);
|
||||
} else {
|
||||
zend_compile_expr(&value_node, value_ast);
|
||||
}
|
||||
@@ -11053,11 +11053,11 @@ static void zend_compile_const(znode *result, zend_ast *ast) /* {{{ */
|
||||
if (is_fully_qualified || !FC(current_namespace)) {
|
||||
opline->op1.num = 0;
|
||||
opline->op2.constant = zend_add_const_name_literal(
|
||||
resolved_name, 0);
|
||||
resolved_name, false);
|
||||
} else {
|
||||
opline->op1.num = IS_CONSTANT_UNQUALIFIED_IN_NAMESPACE;
|
||||
opline->op2.constant = zend_add_const_name_literal(
|
||||
resolved_name, 1);
|
||||
resolved_name, true);
|
||||
}
|
||||
opline->extended_value = zend_alloc_cache_slot();
|
||||
}
|
||||
@@ -11669,7 +11669,7 @@ void zend_compile_top_stmt(zend_ast *ast) /* {{{ */
|
||||
CG(zend_lineno) = ((zend_ast_decl *) ast)->end_lineno;
|
||||
} else if (ast->kind == ZEND_AST_CLASS) {
|
||||
CG(zend_lineno) = ast->lineno;
|
||||
zend_compile_class_decl(NULL, ast, 1);
|
||||
zend_compile_class_decl(NULL, ast, true);
|
||||
CG(zend_lineno) = ((zend_ast_decl *) ast)->end_lineno;
|
||||
} else {
|
||||
zend_compile_stmt(ast);
|
||||
@@ -11762,7 +11762,7 @@ static void zend_compile_stmt(zend_ast *ast) /* {{{ */
|
||||
zend_compile_use_trait(ast);
|
||||
break;
|
||||
case ZEND_AST_CLASS:
|
||||
zend_compile_class_decl(NULL, ast, 0);
|
||||
zend_compile_class_decl(NULL, ast, false);
|
||||
break;
|
||||
case ZEND_AST_GROUP_USE:
|
||||
zend_compile_group_use(ast);
|
||||
@@ -11827,7 +11827,7 @@ static void zend_compile_expr_inner(znode *result, zend_ast *ast) /* {{{ */
|
||||
case ZEND_AST_NULLSAFE_METHOD_CALL:
|
||||
case ZEND_AST_STATIC_CALL:
|
||||
case ZEND_AST_PARENT_PROPERTY_HOOK_CALL:
|
||||
zend_compile_var(result, ast, BP_VAR_R, 0);
|
||||
zend_compile_var(result, ast, BP_VAR_R, false);
|
||||
return;
|
||||
case ZEND_AST_ASSIGN:
|
||||
zend_compile_assign(result, ast);
|
||||
@@ -11968,14 +11968,14 @@ static zend_op *zend_compile_var_inner(znode *result, zend_ast *ast, uint32_t ty
|
||||
|
||||
switch (ast->kind) {
|
||||
case ZEND_AST_VAR:
|
||||
return zend_compile_simple_var(result, ast, type, 0);
|
||||
return zend_compile_simple_var(result, ast, type, false);
|
||||
case ZEND_AST_DIM:
|
||||
return zend_compile_dim(result, ast, type, by_ref);
|
||||
case ZEND_AST_PROP:
|
||||
case ZEND_AST_NULLSAFE_PROP:
|
||||
return zend_compile_prop(result, ast, type, by_ref);
|
||||
case ZEND_AST_STATIC_PROP:
|
||||
return zend_compile_static_prop(result, ast, type, by_ref, 0);
|
||||
return zend_compile_static_prop(result, ast, type, by_ref, false);
|
||||
case ZEND_AST_CALL:
|
||||
zend_compile_call(result, ast, type);
|
||||
return NULL;
|
||||
@@ -12019,7 +12019,7 @@ static zend_op *zend_delayed_compile_var(znode *result, zend_ast *ast, uint32_t
|
||||
|
||||
switch (ast->kind) {
|
||||
case ZEND_AST_VAR:
|
||||
return zend_compile_simple_var(result, ast, type, 1);
|
||||
return zend_compile_simple_var(result, ast, type, true);
|
||||
case ZEND_AST_DIM:
|
||||
return zend_delayed_compile_dim(result, ast, type, by_ref);
|
||||
case ZEND_AST_PROP:
|
||||
@@ -12032,9 +12032,9 @@ static zend_op *zend_delayed_compile_var(znode *result, zend_ast *ast, uint32_t
|
||||
return opline;
|
||||
}
|
||||
case ZEND_AST_STATIC_PROP:
|
||||
return zend_compile_static_prop(result, ast, type, by_ref, 1);
|
||||
return zend_compile_static_prop(result, ast, type, by_ref, true);
|
||||
default:
|
||||
return zend_compile_var(result, ast, type, 0);
|
||||
return zend_compile_var(result, ast, type, false);
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -1051,7 +1051,7 @@ static zend_always_inline bool i_zend_check_property_type(const zend_property_in
|
||||
|
||||
uint32_t type_mask = ZEND_TYPE_FULL_MASK(info->type);
|
||||
ZEND_ASSERT(!(type_mask & (MAY_BE_CALLABLE|MAY_BE_STATIC|MAY_BE_NEVER|MAY_BE_VOID)));
|
||||
return zend_verify_scalar_type_hint(type_mask, property, strict, 0);
|
||||
return zend_verify_scalar_type_hint(type_mask, property, strict, false);
|
||||
}
|
||||
|
||||
static zend_always_inline bool i_zend_verify_property_type(const zend_property_info *info, zval *property, bool strict)
|
||||
@@ -1246,7 +1246,7 @@ static zend_always_inline bool zend_verify_recv_arg_type(const zend_function *zf
|
||||
cur_arg_info = &zf->common.arg_info[arg_num-1];
|
||||
|
||||
if (ZEND_TYPE_IS_SET(cur_arg_info->type)
|
||||
&& UNEXPECTED(!zend_check_type(&cur_arg_info->type, arg, zf->common.scope, 0, 0))) {
|
||||
&& UNEXPECTED(!zend_check_type(&cur_arg_info->type, arg, zf->common.scope, false, false))) {
|
||||
zend_verify_arg_error(zf, cur_arg_info, arg_num, arg);
|
||||
return 0;
|
||||
}
|
||||
@@ -1258,7 +1258,7 @@ static zend_always_inline bool zend_verify_variadic_arg_type(
|
||||
const zend_function *zf, const zend_arg_info *arg_info, uint32_t arg_num, zval *arg)
|
||||
{
|
||||
ZEND_ASSERT(ZEND_TYPE_IS_SET(arg_info->type));
|
||||
if (UNEXPECTED(!zend_check_type(&arg_info->type, arg, zf->common.scope, 0, 0))) {
|
||||
if (UNEXPECTED(!zend_check_type(&arg_info->type, arg, zf->common.scope, false, false))) {
|
||||
zend_verify_arg_error(zf, arg_info, arg_num, arg);
|
||||
return 0;
|
||||
}
|
||||
@@ -1283,7 +1283,7 @@ static zend_never_inline ZEND_ATTRIBUTE_UNUSED bool zend_verify_internal_arg_typ
|
||||
}
|
||||
|
||||
if (ZEND_TYPE_IS_SET(cur_arg_info->type)
|
||||
&& UNEXPECTED(!zend_check_type(&cur_arg_info->type, arg, fbc->common.scope, 0, /* is_internal */ 1))) {
|
||||
&& UNEXPECTED(!zend_check_type(&cur_arg_info->type, arg, fbc->common.scope, false, /* is_internal */ true))) {
|
||||
return 0;
|
||||
}
|
||||
arg++;
|
||||
@@ -1489,7 +1489,7 @@ ZEND_API bool zend_verify_internal_return_type(const zend_function *zf, zval *re
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (UNEXPECTED(!zend_check_type(&ret_info->type, ret, NULL, 1, /* is_internal */ 1))) {
|
||||
if (UNEXPECTED(!zend_check_type(&ret_info->type, ret, NULL, true, /* is_internal */ true))) {
|
||||
zend_verify_internal_return_error(zf, ret);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1430,14 +1430,14 @@ ZEND_API ZEND_NORETURN void ZEND_FASTCALL zend_timeout(void) /* {{{ */
|
||||
function. */
|
||||
if (EG(hard_timeout) > 0) {
|
||||
zend_atomic_bool_store_ex(&EG(timed_out), false);
|
||||
zend_set_timeout_ex(EG(hard_timeout), 1);
|
||||
zend_set_timeout_ex(EG(hard_timeout), true);
|
||||
/* XXX Abused, introduce an additional flag if the value needs to be kept. */
|
||||
EG(hard_timeout) = 0;
|
||||
}
|
||||
# endif
|
||||
#else
|
||||
zend_atomic_bool_store_ex(&EG(timed_out), false);
|
||||
zend_set_timeout_ex(0, 1);
|
||||
zend_set_timeout_ex(0, true);
|
||||
#endif
|
||||
|
||||
zend_error_noreturn(E_ERROR, "Maximum execution time of " ZEND_LONG_FMT " second%s exceeded", EG(timeout_seconds), EG(timeout_seconds) == 1 ? "" : "s");
|
||||
@@ -1522,7 +1522,7 @@ static void zend_timeout_handler(int dummy) /* {{{ */
|
||||
#ifndef ZTS
|
||||
if (EG(hard_timeout) > 0) {
|
||||
/* Set hard timeout */
|
||||
zend_set_timeout_ex(EG(hard_timeout), 1);
|
||||
zend_set_timeout_ex(EG(hard_timeout), true);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -281,7 +281,7 @@ static void zend_generator_dtor_storage(zend_object *object) /* {{{ */
|
||||
|
||||
if (EXPECTED(!ex) || EXPECTED(!(ex->func->op_array.fn_flags & ZEND_ACC_HAS_FINALLY_BLOCK))
|
||||
|| CG(unclean_shutdown)) {
|
||||
zend_generator_close(generator, 0);
|
||||
zend_generator_close(generator, false);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -351,7 +351,7 @@ static void zend_generator_dtor_storage(zend_object *object) /* {{{ */
|
||||
try_catch_offset--;
|
||||
}
|
||||
|
||||
zend_generator_close(generator, 0);
|
||||
zend_generator_close(generator, false);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -359,7 +359,7 @@ static void zend_generator_free_storage(zend_object *object) /* {{{ */
|
||||
{
|
||||
zend_generator *generator = (zend_generator*) object;
|
||||
|
||||
zend_generator_close(generator, 0);
|
||||
zend_generator_close(generator, false);
|
||||
|
||||
if (generator->func && (generator->func->common.fn_flags & ZEND_ACC_CLOSURE)) {
|
||||
OBJ_RELEASE(ZEND_CLOSURE_OBJECT(generator->func));
|
||||
@@ -856,7 +856,7 @@ try_again:
|
||||
* its calling frame (see above in if (check_yield_from). */
|
||||
if (UNEXPECTED(EG(exception) != NULL)) {
|
||||
if (generator == orig_generator) {
|
||||
zend_generator_close(generator, 0);
|
||||
zend_generator_close(generator, false);
|
||||
if (!EG(current_execute_data)) {
|
||||
zend_throw_exception_internal(NULL);
|
||||
} else if (EG(current_execute_data)->func &&
|
||||
|
||||
@@ -281,14 +281,14 @@ ZEND_API void ZEND_FASTCALL _zend_hash_init(HashTable *ht, uint32_t nSize, dtor_
|
||||
ZEND_API HashTable* ZEND_FASTCALL _zend_new_array_0(void)
|
||||
{
|
||||
HashTable *ht = emalloc(sizeof(HashTable));
|
||||
_zend_hash_init_int(ht, HT_MIN_SIZE, ZVAL_PTR_DTOR, 0);
|
||||
_zend_hash_init_int(ht, HT_MIN_SIZE, ZVAL_PTR_DTOR, false);
|
||||
return ht;
|
||||
}
|
||||
|
||||
ZEND_API HashTable* ZEND_FASTCALL _zend_new_array(uint32_t nSize)
|
||||
{
|
||||
HashTable *ht = emalloc(sizeof(HashTable));
|
||||
_zend_hash_init_int(ht, nSize, ZVAL_PTR_DTOR, 0);
|
||||
_zend_hash_init_int(ht, nSize, ZVAL_PTR_DTOR, false);
|
||||
return ht;
|
||||
}
|
||||
|
||||
@@ -296,7 +296,7 @@ ZEND_API HashTable* ZEND_FASTCALL zend_new_pair(const zval *val1, const zval *va
|
||||
{
|
||||
zval *zv;
|
||||
HashTable *ht = emalloc(sizeof(HashTable));
|
||||
_zend_hash_init_int(ht, HT_MIN_SIZE, ZVAL_PTR_DTOR, 0);
|
||||
_zend_hash_init_int(ht, HT_MIN_SIZE, ZVAL_PTR_DTOR, false);
|
||||
ht->nNumUsed = ht->nNumOfElements = ht->nNextFreeElement = 2;
|
||||
zend_hash_real_init_packed_ex(ht);
|
||||
|
||||
@@ -2375,7 +2375,7 @@ static zend_always_inline void zend_array_dup_packed_elements(const HashTable *s
|
||||
const zval *end = p + source->nNumUsed;
|
||||
|
||||
do {
|
||||
if (!zend_array_dup_value(source, p, q, 1, with_holes)) {
|
||||
if (!zend_array_dup_value(source, p, q, true, with_holes)) {
|
||||
if (with_holes) {
|
||||
ZVAL_UNDEF(q);
|
||||
}
|
||||
@@ -2400,13 +2400,13 @@ static zend_always_inline uint32_t zend_array_dup_elements(const HashTable *sour
|
||||
}
|
||||
|
||||
do {
|
||||
if (!zend_array_dup_element(source, target, idx, p, q, 0, static_keys, with_holes)) {
|
||||
if (!zend_array_dup_element(source, target, idx, p, q, false, static_keys, with_holes)) {
|
||||
uint32_t target_idx = idx;
|
||||
|
||||
idx++; p++;
|
||||
if (EXPECTED(!HT_HAS_ITERATORS(target))) {
|
||||
while (p != end) {
|
||||
if (zend_array_dup_element(source, target, target_idx, p, q, 0, static_keys, with_holes)) {
|
||||
if (zend_array_dup_element(source, target, target_idx, p, q, false, static_keys, with_holes)) {
|
||||
if (source->nInternalPointer == idx) {
|
||||
target->nInternalPointer = target_idx;
|
||||
}
|
||||
@@ -2419,7 +2419,7 @@ static zend_always_inline uint32_t zend_array_dup_elements(const HashTable *sour
|
||||
uint32_t iter_pos = zend_hash_iterators_lower_pos(target, idx);
|
||||
|
||||
while (p != end) {
|
||||
if (zend_array_dup_element(source, target, target_idx, p, q, 0, static_keys, with_holes)) {
|
||||
if (zend_array_dup_element(source, target, target_idx, p, q, false, static_keys, with_holes)) {
|
||||
if (source->nInternalPointer == idx) {
|
||||
target->nInternalPointer = target_idx;
|
||||
}
|
||||
@@ -2496,9 +2496,9 @@ ZEND_API HashTable* ZEND_FASTCALL zend_array_dup(const HashTable *source)
|
||||
HT_HASH_RESET_PACKED(target);
|
||||
|
||||
if (HT_IS_WITHOUT_HOLES(target)) {
|
||||
zend_array_dup_packed_elements(source, target, 0);
|
||||
zend_array_dup_packed_elements(source, target, false);
|
||||
} else {
|
||||
zend_array_dup_packed_elements(source, target, 1);
|
||||
zend_array_dup_packed_elements(source, target, true);
|
||||
}
|
||||
} else {
|
||||
/* Indirects are removed during duplication, remove HASH_FLAG_HAS_EMPTY_IND accordingly. */
|
||||
@@ -2515,15 +2515,15 @@ ZEND_API HashTable* ZEND_FASTCALL zend_array_dup(const HashTable *source)
|
||||
|
||||
if (HT_HAS_STATIC_KEYS_ONLY(target)) {
|
||||
if (HT_IS_WITHOUT_HOLES(source)) {
|
||||
idx = zend_array_dup_elements(source, target, 1, 0);
|
||||
idx = zend_array_dup_elements(source, target, true, false);
|
||||
} else {
|
||||
idx = zend_array_dup_elements(source, target, 1, 1);
|
||||
idx = zend_array_dup_elements(source, target, true, true);
|
||||
}
|
||||
} else {
|
||||
if (HT_IS_WITHOUT_HOLES(source)) {
|
||||
idx = zend_array_dup_elements(source, target, 0, 0);
|
||||
idx = zend_array_dup_elements(source, target, false, false);
|
||||
} else {
|
||||
idx = zend_array_dup_elements(source, target, 0, 1);
|
||||
idx = zend_array_dup_elements(source, target, false, true);
|
||||
}
|
||||
}
|
||||
target->nNumUsed = idx;
|
||||
|
||||
@@ -942,7 +942,7 @@ static ZEND_COLD zend_string *zend_get_function_declaration(
|
||||
num_args++;
|
||||
}
|
||||
for (uint32_t i = 0; i < num_args;) {
|
||||
zend_append_type_hint(&str, scope, arg_info, 0);
|
||||
zend_append_type_hint(&str, scope, arg_info, false);
|
||||
|
||||
if (ZEND_ARG_SEND_MODE(arg_info)) {
|
||||
smart_str_appendc(&str, '&');
|
||||
@@ -1039,7 +1039,7 @@ static ZEND_COLD zend_string *zend_get_function_declaration(
|
||||
|
||||
if (fptr->common.fn_flags & ZEND_ACC_HAS_RETURN_TYPE) {
|
||||
smart_str_appends(&str, ": ");
|
||||
zend_append_type_hint(&str, scope, fptr->common.arg_info - 1, 1);
|
||||
zend_append_type_hint(&str, scope, fptr->common.arg_info - 1, true);
|
||||
}
|
||||
smart_str_0(&str);
|
||||
|
||||
@@ -2036,7 +2036,7 @@ ZEND_API void zend_do_inheritance_ex(zend_class_entry *ce, zend_class_entry *par
|
||||
}
|
||||
zend_function *func;
|
||||
ZEND_HASH_MAP_FOREACH_STR_KEY_PTR(&parent_ce->function_table, key, func) {
|
||||
do_inherit_method(key, func, ce, 0, flags);
|
||||
do_inherit_method(key, func, ce, false, flags);
|
||||
} ZEND_HASH_FOREACH_END();
|
||||
}
|
||||
|
||||
@@ -2189,7 +2189,7 @@ static void do_interface_implementation(zend_class_entry *ce, zend_class_entry *
|
||||
} ZEND_HASH_FOREACH_END();
|
||||
|
||||
ZEND_HASH_MAP_FOREACH_STR_KEY_PTR(&iface->function_table, key, func) {
|
||||
do_inherit_method(key, func, ce, 1, flags);
|
||||
do_inherit_method(key, func, ce, true, flags);
|
||||
} ZEND_HASH_FOREACH_END();
|
||||
|
||||
zend_hash_extend(&ce->properties_info,
|
||||
|
||||
@@ -332,7 +332,7 @@ ZEND_API void zend_ini_refresh_caches(int stage) /* {{{ */
|
||||
ZEND_API zend_result zend_alter_ini_entry(zend_string *name, zend_string *new_value, int modify_type, int stage) /* {{{ */
|
||||
{
|
||||
|
||||
return zend_alter_ini_entry_ex(name, new_value, modify_type, stage, 0);
|
||||
return zend_alter_ini_entry_ex(name, new_value, modify_type, stage, false);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -342,7 +342,7 @@ ZEND_API zend_result zend_alter_ini_entry_chars(zend_string *name, const char *v
|
||||
zend_string *new_value;
|
||||
|
||||
new_value = zend_string_init(value, value_length, !(stage & ZEND_INI_STAGE_IN_REQUEST));
|
||||
ret = zend_alter_ini_entry_ex(name, new_value, modify_type, stage, 0);
|
||||
ret = zend_alter_ini_entry_ex(name, new_value, modify_type, stage, false);
|
||||
zend_string_release(new_value);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -195,7 +195,7 @@ ZEND_API zend_result zend_multibyte_set_script_encoding_by_string(const char *ne
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
if (FAILURE == zend_multibyte_parse_encoding_list(new_value, new_value_length, &list, &size, 1)) {
|
||||
if (FAILURE == zend_multibyte_parse_encoding_list(new_value, new_value_length, &list, &size, true)) {
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
|
||||
@@ -1821,7 +1821,7 @@ ZEND_API zend_function *zend_get_property_hook_trampoline(
|
||||
|
||||
static zend_always_inline zend_function *zend_get_user_call_function(zend_class_entry *ce, zend_string *method_name) /* {{{ */
|
||||
{
|
||||
return zend_get_call_trampoline_func(ce, method_name, 0);
|
||||
return zend_get_call_trampoline_func(ce, method_name, false);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -1915,7 +1915,7 @@ exit:
|
||||
|
||||
static zend_always_inline zend_function *zend_get_user_callstatic_function(zend_class_entry *ce, zend_string *method_name) /* {{{ */
|
||||
{
|
||||
return zend_get_call_trampoline_func(ce, method_name, 1);
|
||||
return zend_get_call_trampoline_func(ce, method_name, true);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
||||
@@ -135,7 +135,7 @@ void zend_free_internal_arg_info(zend_internal_function *function) {
|
||||
num_args++;
|
||||
}
|
||||
for (i = 0 ; i < num_args; i++) {
|
||||
zend_type_release(arg_info[i].type, /* persistent */ 1);
|
||||
zend_type_release(arg_info[i].type, /* persistent */ true);
|
||||
}
|
||||
free(arg_info);
|
||||
}
|
||||
@@ -396,7 +396,7 @@ ZEND_API void destroy_zend_class(zval *zv)
|
||||
if (prop_info->attributes) {
|
||||
zend_hash_release(prop_info->attributes);
|
||||
}
|
||||
zend_type_release(prop_info->type, /* persistent */ 0);
|
||||
zend_type_release(prop_info->type, /* persistent */ false);
|
||||
if (prop_info->hooks) {
|
||||
for (uint32_t i = 0; i < ZEND_PROPERTY_HOOK_COUNT; i++) {
|
||||
if (prop_info->hooks[i]) {
|
||||
@@ -463,7 +463,7 @@ ZEND_API void destroy_zend_class(zval *zv)
|
||||
ZEND_HASH_MAP_FOREACH_PTR(&ce->properties_info, prop_info) {
|
||||
if (prop_info->ce == ce) {
|
||||
zend_string_release(prop_info->name);
|
||||
zend_type_release(prop_info->type, /* persistent */ 1);
|
||||
zend_type_release(prop_info->type, /* persistent */ true);
|
||||
if (prop_info->attributes) {
|
||||
zend_hash_release(prop_info->attributes);
|
||||
}
|
||||
@@ -639,7 +639,7 @@ ZEND_API void destroy_op_array(zend_op_array *op_array)
|
||||
if (arg_info[i].name) {
|
||||
zend_string_release_ex(arg_info[i].name, 0);
|
||||
}
|
||||
zend_type_release(arg_info[i].type, /* persistent */ 0);
|
||||
zend_type_release(arg_info[i].type, /* persistent */ false);
|
||||
}
|
||||
efree(arg_info);
|
||||
}
|
||||
|
||||
@@ -1106,13 +1106,13 @@ try_again:
|
||||
|
||||
ZEND_API zend_string* ZEND_FASTCALL zval_get_string_func(zval *op) /* {{{ */
|
||||
{
|
||||
return __zval_get_string_func(op, 0);
|
||||
return __zval_get_string_func(op, false);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
ZEND_API zend_string* ZEND_FASTCALL zval_try_get_string_func(zval *op) /* {{{ */
|
||||
{
|
||||
return __zval_get_string_func(op, 1);
|
||||
return __zval_get_string_func(op, true);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ ZEND_API void zend_ptr_stack_init_ex(zend_ptr_stack *stack, bool persistent)
|
||||
|
||||
ZEND_API void zend_ptr_stack_init(zend_ptr_stack *stack)
|
||||
{
|
||||
zend_ptr_stack_init_ex(stack, 0);
|
||||
zend_ptr_stack_init_ex(stack, false);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -94,7 +94,7 @@ ZEND_API void zend_interned_strings_init(void)
|
||||
zend_empty_string = NULL;
|
||||
zend_known_strings = NULL;
|
||||
|
||||
zend_init_interned_strings_ht(&interned_strings_permanent, 1);
|
||||
zend_init_interned_strings_ht(&interned_strings_permanent, true);
|
||||
|
||||
zend_new_interned_string = zend_new_interned_string_permanent;
|
||||
zend_string_init_interned = zend_string_init_interned_permanent;
|
||||
@@ -345,7 +345,7 @@ static zend_string* ZEND_FASTCALL zend_string_init_existing_interned_request(con
|
||||
|
||||
ZEND_API void zend_interned_strings_activate(void)
|
||||
{
|
||||
zend_init_interned_strings_ht(&CG(interned_strings), 0);
|
||||
zend_init_interned_strings_ht(&CG(interned_strings), false);
|
||||
}
|
||||
|
||||
ZEND_API void zend_interned_strings_deactivate(void)
|
||||
|
||||
@@ -535,7 +535,7 @@ static size_t tsrm_realpath_r(char *path, size_t start, size_t len, int *ll, tim
|
||||
if (i <= start + 1) {
|
||||
return start ? start : len;
|
||||
}
|
||||
j = tsrm_realpath_r(path, start, i-1, ll, t, use_realpath, 1, NULL);
|
||||
j = tsrm_realpath_r(path, start, i-1, ll, t, use_realpath, true, NULL);
|
||||
if (j > start && j != (size_t)-1) {
|
||||
j--;
|
||||
assert(i < MAXPATHLEN);
|
||||
@@ -948,7 +948,8 @@ retry_reparse_tag_cloud:
|
||||
j = start;
|
||||
} else {
|
||||
/* some leading directories may be inaccessible */
|
||||
j = tsrm_realpath_r(path, start, i-1, ll, t, save ? CWD_FILEPATH : use_realpath, 1, NULL);
|
||||
j = tsrm_realpath_r(path, start, i-1, ll, t, save ? CWD_FILEPATH : use_realpath, true,
|
||||
NULL);
|
||||
if (j > start && j != (size_t)-1) {
|
||||
path[j++] = DEFAULT_SLASH;
|
||||
}
|
||||
@@ -1138,7 +1139,7 @@ CWD_API int virtual_file_ex(cwd_state *state, const char *path, verify_path_func
|
||||
|
||||
add_slash = (use_realpath != CWD_REALPATH) && path_length > 0 && IS_SLASH(resolved_path[path_length-1]);
|
||||
t = CWDG(realpath_cache_ttl) ? 0 : -1;
|
||||
path_length = tsrm_realpath_r(resolved_path, start, path_length, &ll, &t, use_realpath, 0, NULL);
|
||||
path_length = tsrm_realpath_r(resolved_path, start, path_length, &ll, &t, use_realpath, false, NULL);
|
||||
|
||||
if (path_length == (size_t)-1) {
|
||||
#ifdef ZEND_WIN32
|
||||
|
||||
@@ -181,7 +181,7 @@ ZEND_API zval *zend_weakrefs_hash_add(HashTable *ht, zend_object *key, zval *pDa
|
||||
ZEND_API zend_result zend_weakrefs_hash_del(HashTable *ht, zend_object *key) {
|
||||
zval *zv = zend_hash_index_find(ht, zend_object_to_weakref_key(key));
|
||||
if (zv) {
|
||||
zend_weakref_unregister(key, ZEND_WEAKREF_ENCODE(ht, ZEND_WEAKREF_TAG_BARE_HT), 1);
|
||||
zend_weakref_unregister(key, ZEND_WEAKREF_ENCODE(ht, ZEND_WEAKREF_TAG_BARE_HT), true);
|
||||
return SUCCESS;
|
||||
}
|
||||
return FAILURE;
|
||||
@@ -194,7 +194,7 @@ static void zend_weakrefs_hash_clean_ex(HashTable *ht, int type) {
|
||||
* Let freeing the corresponding values for WeakMap entries be done in zend_hash_clean, freeing objects sequentially.
|
||||
* The performance difference is notable for larger WeakMaps with worse cache locality. */
|
||||
zend_weakref_unregister(
|
||||
zend_weakref_key_to_object(obj_key), ZEND_WEAKREF_ENCODE(ht, type), 0);
|
||||
zend_weakref_key_to_object(obj_key), ZEND_WEAKREF_ENCODE(ht, type), false);
|
||||
} ZEND_HASH_FOREACH_END();
|
||||
zend_hash_clean(ht);
|
||||
}
|
||||
@@ -285,7 +285,7 @@ static void zend_weakref_free(zend_object *zo) {
|
||||
zend_weakref *wr = zend_weakref_from(zo);
|
||||
|
||||
if (wr->referent) {
|
||||
zend_weakref_unregister(wr->referent, ZEND_WEAKREF_ENCODE(wr, ZEND_WEAKREF_TAG_REF), 1);
|
||||
zend_weakref_unregister(wr->referent, ZEND_WEAKREF_ENCODE(wr, ZEND_WEAKREF_TAG_REF), true);
|
||||
}
|
||||
|
||||
zend_object_std_dtor(&wr->std);
|
||||
@@ -455,7 +455,7 @@ static void zend_weakmap_unset_dimension(zend_object *object, zval *offset)
|
||||
return;
|
||||
}
|
||||
|
||||
zend_weakref_unregister(obj_addr, ZEND_WEAKREF_ENCODE(&wm->ht, ZEND_WEAKREF_TAG_MAP), 1);
|
||||
zend_weakref_unregister(obj_addr, ZEND_WEAKREF_ENCODE(&wm->ht, ZEND_WEAKREF_TAG_MAP), true);
|
||||
}
|
||||
|
||||
static zend_result zend_weakmap_count_elements(zend_object *object, zend_long *count)
|
||||
|
||||
Reference in New Issue
Block a user