diff --git a/TSRM/TSRM.c b/TSRM/TSRM.c index 0cc192473116..61f755e43065 100644 --- a/TSRM/TSRM.c +++ b/TSRM/TSRM.c @@ -148,7 +148,7 @@ TSRM_API bool tsrm_startup(int expected_threads, int expected_resources, int deb if (!tsrm_tls_table) { TSRM_ERROR((TSRM_ERROR_LEVEL_ERROR, "Unable to allocate TLS table")); is_thread_shutdown = true; - return 0; + return false; } id_count=0; @@ -158,7 +158,7 @@ TSRM_API bool tsrm_startup(int expected_threads, int expected_resources, int deb TSRM_ERROR((TSRM_ERROR_LEVEL_ERROR, "Unable to allocate resource types table")); is_thread_shutdown = true; free(tsrm_tls_table); - return 0; + return false; } tsmm_mutex = tsrm_mutex_alloc(); @@ -171,7 +171,7 @@ TSRM_API bool tsrm_startup(int expected_threads, int expected_resources, int deb tsrm_env_mutex = tsrm_mutex_alloc(); tsrm_atexit_init(); - return 1; + return true; }/*}}}*/ static void ts_free_resources( diff --git a/Zend/Optimizer/block_pass.c b/Zend/Optimizer/block_pass.c index f790c3bf620d..3f620a70f8ca 100644 --- a/Zend/Optimizer/block_pass.c +++ b/Zend/Optimizer/block_pass.c @@ -1208,10 +1208,10 @@ static zend_always_inline bool in_hitlist(int target, const int *jmp_hitlist, in for (i = 0; i < jmp_hitlist_count; i++) { if (jmp_hitlist[i] == target) { - return 1; + return true; } } - return 0; + return false; } #define CHECK_LOOP(target) \ diff --git a/Zend/Optimizer/zend_inference.c b/Zend/Optimizer/zend_inference.c index 37bdaf383e8b..6834166c875f 100644 --- a/Zend/Optimizer/zend_inference.c +++ b/Zend/Optimizer/zend_inference.c @@ -1282,7 +1282,7 @@ ZEND_API bool zend_inference_propagate_range(const zend_op_array *op_array, cons tmp->min = ~op1_max; tmp->max = ~op1_min; } - return 1; + return true; } } break; @@ -1294,7 +1294,7 @@ ZEND_API bool zend_inference_propagate_range(const zend_op_array *op_array, cons tmp->min = OP1_MIN_RANGE(); tmp->max = OP1_MAX_RANGE(); tmp->overflow = OP1_RANGE_OVERFLOW(); - return 1; + return true; } } } else if (ssa_op->result_def == var) { @@ -1302,11 +1302,11 @@ ZEND_API bool zend_inference_propagate_range(const zend_op_array *op_array, cons if (OP1_HAS_RANGE()) { tmp->min = OP1_MIN_RANGE(); tmp->max = OP1_MAX_RANGE(); - return 1; + return true; } else { tmp->min = ZEND_LONG_MIN; tmp->max = ZEND_LONG_MAX; - return 1; + return true; } } } @@ -1322,7 +1322,7 @@ ZEND_API bool zend_inference_propagate_range(const zend_op_array *op_array, cons tmp->min = OP1_MIN_RANGE(); tmp->max = OP1_MAX_RANGE(); tmp->overflow = OP1_RANGE_OVERFLOW(); - return 1; + return true; } } } @@ -1332,7 +1332,7 @@ ZEND_API bool zend_inference_propagate_range(const zend_op_array *op_array, cons tmp->max = OP1_MAX_RANGE(); tmp->underflow = OP1_RANGE_UNDERFLOW(); tmp->overflow = OP1_RANGE_OVERFLOW(); - return 1; + return true; } } break; @@ -1344,7 +1344,7 @@ ZEND_API bool zend_inference_propagate_range(const zend_op_array *op_array, cons tmp->min = OP1_MIN_RANGE(); tmp->max = OP1_MAX_RANGE(); tmp->overflow = OP1_RANGE_OVERFLOW(); - return 1; + return true; } } } @@ -1364,7 +1364,7 @@ ZEND_API bool zend_inference_propagate_range(const zend_op_array *op_array, cons if (tmp->min < ZEND_LONG_MAX && !tmp->underflow) { tmp->min++; } - return 1; + return true; } } break; @@ -1383,7 +1383,7 @@ ZEND_API bool zend_inference_propagate_range(const zend_op_array *op_array, cons if (tmp->max > ZEND_LONG_MIN && !tmp->overflow) { tmp->max--; } - return 1; + return true; } } break; @@ -1395,7 +1395,7 @@ ZEND_API bool zend_inference_propagate_range(const zend_op_array *op_array, cons tmp->underflow = OP1_RANGE_UNDERFLOW(); tmp->overflow = OP1_RANGE_OVERFLOW(); if (ssa_op->result_def == var) { - return 1; + return true; } if (tmp->max < ZEND_LONG_MAX) { tmp->max++; @@ -1405,7 +1405,7 @@ ZEND_API bool zend_inference_propagate_range(const zend_op_array *op_array, cons if (tmp->min < ZEND_LONG_MAX && !tmp->underflow) { tmp->min++; } - return 1; + return true; } } break; @@ -1417,7 +1417,7 @@ ZEND_API bool zend_inference_propagate_range(const zend_op_array *op_array, cons tmp->underflow = OP1_RANGE_UNDERFLOW(); tmp->overflow = OP1_RANGE_OVERFLOW(); if (ssa_op->result_def == var) { - return 1; + return true; } if (tmp->min > ZEND_LONG_MIN) { tmp->min--; @@ -1427,7 +1427,7 @@ ZEND_API bool zend_inference_propagate_range(const zend_op_array *op_array, cons if (tmp->max > ZEND_LONG_MIN && !tmp->overflow) { tmp->max--; } - return 1; + return true; } } break; @@ -1441,7 +1441,7 @@ ZEND_API bool zend_inference_propagate_range(const zend_op_array *op_array, cons tmp->max = OP1_MAX_RANGE(); tmp->underflow = OP1_RANGE_UNDERFLOW(); tmp->overflow = OP1_RANGE_OVERFLOW(); - return 1; + return true; } } break; @@ -1454,7 +1454,7 @@ ZEND_API bool zend_inference_propagate_range(const zend_op_array *op_array, cons tmp->max = OP2_MAX_RANGE(); tmp->underflow = OP2_RANGE_UNDERFLOW(); tmp->overflow = OP2_RANGE_OVERFLOW(); - return 1; + return true; } } break; @@ -1473,7 +1473,7 @@ ZEND_API bool zend_inference_propagate_range(const zend_op_array *op_array, cons tmp->underflow = OP1_RANGE_UNDERFLOW(); tmp->overflow = OP1_RANGE_OVERFLOW(); } - return 1; + return true; } break; case ZEND_ASSIGN_OP: @@ -1499,7 +1499,7 @@ ZEND_API bool zend_inference_propagate_range(const zend_op_array *op_array, cons tmp->max = OP1_MAX_RANGE(); tmp->underflow = OP1_RANGE_UNDERFLOW(); tmp->overflow = OP1_RANGE_OVERFLOW(); - return 1; + return true; } } break; @@ -1517,7 +1517,7 @@ ZEND_API bool zend_inference_propagate_range(const zend_op_array *op_array, cons tmp->min = ZEND_LONG_MIN; tmp->max = ZEND_LONG_MAX; tmp->overflow = 0; - return 1; + return true; } } } @@ -1533,22 +1533,22 @@ ZEND_API bool zend_inference_propagate_range(const zend_op_array *op_array, cons tmp->min = 0; #endif tmp->max = ZEND_LONG_MAX; - return 1; + return true; } break; case ZEND_FUNC_NUM_ARGS: tmp->min = 0; tmp->max = ZEND_LONG_MAX; - return 1; + return true; case ZEND_SPACESHIP: tmp->min = -1; tmp->max = 1; - return 1; + return true; case ZEND_COUNT: /* count() on Countable objects may return negative numbers */ tmp->min = ZEND_LONG_MIN; tmp->max = ZEND_LONG_MAX; - return 1; + return true; case ZEND_DO_FCALL: case ZEND_DO_ICALL: case ZEND_DO_UCALL: @@ -1568,7 +1568,7 @@ ZEND_API bool zend_inference_propagate_range(const zend_op_array *op_array, cons func_info = ZEND_FUNC_INFO(&call_info->callee_func->op_array); if (func_info && func_info->return_info.has_range) { *tmp = func_info->return_info.range; - return 1; + return true; } } //TODO: we can't use type inference for internal functions at this point ??? @@ -1590,7 +1590,7 @@ ZEND_API bool zend_inference_propagate_range(const zend_op_array *op_array, cons } tmp->max = 1; } - return 1; + return true; } #endif } @@ -1599,7 +1599,7 @@ ZEND_API bool zend_inference_propagate_range(const zend_op_array *op_array, cons default: break; } - return 0; + return false; } static void zend_inference_init_range(const zend_op_array *op_array, const zend_ssa *ssa, int var, bool underflow, zend_long min, zend_long max, bool overflow) @@ -4948,7 +4948,7 @@ ZEND_API bool zend_may_throw_ex(const zend_op *opline, const zend_ssa_op *ssa_op switch (opline->opcode) { case ZEND_UNSET_VAR: case ZEND_ISSET_ISEMPTY_VAR: - return 1; + return true; case ZEND_ISSET_ISEMPTY_DIM_OBJ: case ZEND_ISSET_ISEMPTY_PROP_OBJ: case ZEND_ASSIGN: @@ -4967,7 +4967,7 @@ ZEND_API bool zend_may_throw_ex(const zend_op *opline, const zend_ssa_op *ssa_op break; default: /* undefined variable warning */ - return 1; + return true; } } } else if (opline->op1_type & (IS_TMP_VAR|IS_VAR)) { @@ -4994,7 +4994,7 @@ ZEND_API bool zend_may_throw_ex(const zend_op *opline, const zend_ssa_op *ssa_op break; default: /* destructor may be called */ - return 1; + return true; } } } @@ -5008,7 +5008,7 @@ ZEND_API bool zend_may_throw_ex(const zend_op *opline, const zend_ssa_op *ssa_op break; default: /* undefined variable warning */ - return 1; + return true; } } } else if (opline->op2_type & (IS_TMP_VAR|IS_VAR)) { @@ -5021,7 +5021,7 @@ ZEND_API bool zend_may_throw_ex(const zend_op *opline, const zend_ssa_op *ssa_op break; default: /* destructor may be called */ - return 1; + return true; } } } @@ -5050,7 +5050,7 @@ ZEND_API bool zend_may_throw_ex(const zend_op *opline, const zend_ssa_op *ssa_op case ZEND_COPY_TMP: case ZEND_JMP_NULL: case ZEND_JMP_FRAMELESS: - return 0; + return false; case ZEND_IS_IDENTICAL: case ZEND_IS_NOT_IDENTICAL: case ZEND_CASE_STRICT: @@ -5066,16 +5066,16 @@ ZEND_API bool zend_may_throw_ex(const zend_op *opline, const zend_ssa_op *ssa_op return opline->op2_type == IS_CONST; case ZEND_INIT_FCALL: /* can't throw, because call is resolved at compile time */ - return 0; + return false; case ZEND_BIND_GLOBAL: if ((opline+1)->opcode == ZEND_BIND_GLOBAL) { return zend_may_throw(opline + 1, ssa_op ? ssa_op + 1 : NULL, op_array, ssa); } - return 0; + return false; case ZEND_ADD: if ((t1 & MAY_BE_ANY) == MAY_BE_ARRAY && (t2 & MAY_BE_ANY) == MAY_BE_ARRAY) { - return 0; + return false; } return (t1 & (MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE)) || (t2 & (MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE)); @@ -5083,7 +5083,7 @@ ZEND_API bool zend_may_throw_ex(const zend_op *opline, const zend_ssa_op *ssa_op if (!OP2_HAS_RANGE() || (OP2_MIN_RANGE() <= 0 && OP2_MAX_RANGE() >= 0)) { /* Division by zero */ - return 1; + return true; } ZEND_FALLTHROUGH; case ZEND_SUB: @@ -5096,7 +5096,7 @@ ZEND_API bool zend_may_throw_ex(const zend_op *opline, const zend_ssa_op *ssa_op if (!OP2_HAS_RANGE() || (OP2_MIN_RANGE() <= 0 && OP2_MAX_RANGE() >= 0)) { /* Division by zero */ - return 1; + return true; } ZEND_FALLTHROUGH; case ZEND_SL: @@ -5114,7 +5114,7 @@ ZEND_API bool zend_may_throw_ex(const zend_op *opline, const zend_ssa_op *ssa_op case ZEND_BW_XOR: if ((t1 & MAY_BE_ANY) == MAY_BE_STRING && (t2 & MAY_BE_ANY) == MAY_BE_STRING) { - return 0; + return false; } return (t1 & (MAY_BE_STRING|MAY_BE_DOUBLE|MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE)) || (t2 & (MAY_BE_STRING|MAY_BE_DOUBLE|MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE)); @@ -5136,7 +5136,7 @@ ZEND_API bool zend_may_throw_ex(const zend_op *opline, const zend_ssa_op *ssa_op return (t1 & (MAY_BE_OBJECT|MAY_BE_DOUBLE)); case ZEND_ISSET_ISEMPTY_CV: if (!(opline->extended_value & ZEND_ISEMPTY)) { - return 0; + return false; } /* empty() casts to bool: objects may have a cast handler, and NAN will warn */ return (t1 & (MAY_BE_OBJECT|MAY_BE_DOUBLE)); @@ -5154,14 +5154,14 @@ ZEND_API bool zend_may_throw_ex(const zend_op *opline, const zend_ssa_op *ssa_op case ZEND_SPACESHIP: if ((t1 & MAY_BE_ANY) == MAY_BE_NULL || (t2 & MAY_BE_ANY) == MAY_BE_NULL) { - return 0; + return false; } return (t1 & (MAY_BE_OBJECT|MAY_BE_ARRAY_OF_ARRAY|MAY_BE_ARRAY_OF_OBJECT)) || (t2 & (MAY_BE_OBJECT|MAY_BE_ARRAY_OF_ARRAY|MAY_BE_ARRAY_OF_OBJECT)); case ZEND_ASSIGN_OP: if (opline->extended_value == ZEND_ADD) { if ((t1 & MAY_BE_ANY) == MAY_BE_ARRAY && (t2 & MAY_BE_ANY) == MAY_BE_ARRAY) { - return 0; + return false; } return (t1 & (MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE)) || (t2 & (MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE)); @@ -5170,7 +5170,7 @@ ZEND_API bool zend_may_throw_ex(const zend_op *opline, const zend_ssa_op *ssa_op if (!OP2_HAS_RANGE() || (OP2_MIN_RANGE() <= 0 && OP2_MAX_RANGE() >= 0)) { /* Division by zero */ - return 1; + return true; } return (t1 & (MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE)) || (t2 & (MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE)); @@ -5193,15 +5193,15 @@ ZEND_API bool zend_may_throw_ex(const zend_op *opline, const zend_ssa_op *ssa_op opline->extended_value == ZEND_BW_XOR) { if ((t1 & MAY_BE_ANY) == MAY_BE_STRING && (t2 & MAY_BE_ANY) == MAY_BE_STRING) { - return 0; + return false; } return (t1 & (MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE)) || (t2 & (MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE)); } - return 1; + return true; case ZEND_ASSIGN: if (t1 & MAY_BE_REF) { - return 1; + return true; } ZEND_FALLTHROUGH; case ZEND_UNSET_VAR: @@ -5210,27 +5210,27 @@ ZEND_API bool zend_may_throw_ex(const zend_op *opline, const zend_ssa_op *ssa_op case ZEND_BIND_INIT_STATIC_OR_JMP: if (t1 & (MAY_BE_OBJECT|MAY_BE_RESOURCE|MAY_BE_ARRAY_OF_OBJECT|MAY_BE_ARRAY_OF_RESOURCE|MAY_BE_ARRAY_OF_ARRAY)) { /* Destructor may throw. */ - return 1; + return true; } - return 0; + return false; case ZEND_ASSIGN_DIM: if ((opline+1)->op1_type == IS_CV) { if (OP1_DATA_INFO() & MAY_BE_UNDEF) { - return 1; + return true; } } if (t1 & (MAY_BE_ARRAY_OF_OBJECT|MAY_BE_ARRAY_OF_RESOURCE|MAY_BE_ARRAY_OF_ARRAY|MAY_BE_ARRAY_OF_REF)) { - return 1; + return true; } return (t1 & (MAY_BE_OBJECT|MAY_BE_RESOURCE|MAY_BE_TRUE|MAY_BE_FALSE|MAY_BE_STRING|MAY_BE_LONG|MAY_BE_DOUBLE)) || opline->op2_type == IS_UNUSED || (t2 & (MAY_BE_UNDEF|MAY_BE_THROWING_KEY)); case ZEND_ASSIGN_OBJ: if (t1 & (MAY_BE_ANY-MAY_BE_OBJECT)) { - return 1; + return true; } if ((opline+1)->op1_type == IS_CV) { if (OP1_DATA_INFO() & MAY_BE_UNDEF) { - return 1; + return true; } } if (ssa_op->op1_use) { @@ -5245,16 +5245,16 @@ ZEND_API bool zend_may_throw_ex(const zend_op *opline, const zend_ssa_op *ssa_op || ce->__get || ce->__set || ce->parent) { - return 1; + return true; } if (opline->op2_type != IS_CONST) { - return 1; + return true; } zend_string *prop_name = Z_STR_P(CRT_CONSTANT(opline->op2)); if (ZSTR_LEN(prop_name) > 0 && ZSTR_VAL(prop_name)[0] == '\0') { - return 1; + return true; } const zend_property_info *prop_info = @@ -5273,7 +5273,7 @@ ZEND_API bool zend_may_throw_ex(const zend_op *opline, const zend_ssa_op *ssa_op /* single type, this excludes bool too as a reference can exist to true or false standalone types. */ || (type_mask & (type_mask - 1)) || (OP1_DATA_INFO() & (MAY_BE_ANY|MAY_BE_UNDEF|MAY_BE_REF)) != type_mask) { - return 1; + return true; } } return !(prop_info->flags & ZEND_ACC_PUBLIC) @@ -5282,7 +5282,7 @@ ZEND_API bool zend_may_throw_ex(const zend_op *opline, const zend_ssa_op *ssa_op return !(ce->ce_flags & ZEND_ACC_ALLOW_DYNAMIC_PROPERTIES); } } - return 1; + return true; case ZEND_ROPE_INIT: case ZEND_ROPE_ADD: case ZEND_ROPE_END: @@ -5297,7 +5297,7 @@ ZEND_API bool zend_may_throw_ex(const zend_op *opline, const zend_ssa_op *ssa_op return (t1 & MAY_BE_ANY) != MAY_BE_ARRAY; case ZEND_RECV_INIT: if (Z_TYPE_P(CRT_CONSTANT(opline->op2)) == IS_CONSTANT_AST) { - return 1; + return true; } if (op_array->fn_flags & ZEND_ACC_HAS_TYPE_HINTS) { uint32_t arg_num = opline->op1.num; @@ -5308,11 +5308,11 @@ ZEND_API bool zend_may_throw_ex(const zend_op *opline, const zend_ssa_op *ssa_op } else if (UNEXPECTED(op_array->fn_flags & ZEND_ACC_VARIADIC)) { cur_arg_info = &op_array->arg_info[op_array->num_args]; } else { - return 0; + return false; } return ZEND_TYPE_IS_SET(cur_arg_info->type); } else { - return 0; + return false; } case ZEND_FETCH_IS: return (t2 & (MAY_BE_ARRAY|MAY_BE_OBJECT)); @@ -5333,48 +5333,48 @@ ZEND_API bool zend_may_throw_ex(const zend_op *opline, const zend_ssa_op *ssa_op case IS_ARRAY: return (t1 & MAY_BE_OBJECT); case IS_OBJECT: - return 0; + return false; default: ZEND_UNREACHABLE(); } /* GCC is getting confused here for the Wimplicit-fallthrough warning with * default: ZEND_UNREACHABLE(); macro */ - return 0; + return false; case ZEND_ARRAY_KEY_EXISTS: if ((t2 & MAY_BE_ANY) != MAY_BE_ARRAY) { - return 1; + return true; } if (t1 & MAY_BE_THROWING_KEY) { - return 1; + return true; } - return 0; + return false; case ZEND_FE_RESET_R: case ZEND_FE_RESET_RW: if ((t1 & (MAY_BE_ANY|MAY_BE_REF)) != MAY_BE_ARRAY) { - return 1; + return true; } - return 0; + return false; case ZEND_FE_FETCH_R: if ((t1 & (MAY_BE_ANY|MAY_BE_REF)) != MAY_BE_ARRAY) { - return 1; + return true; } if (opline->op2_type == IS_CV && (t2 & MAY_BE_RC1) && (t2 & (MAY_BE_OBJECT|MAY_BE_RESOURCE|MAY_BE_ARRAY_OF_OBJECT|MAY_BE_ARRAY_OF_RESOURCE|MAY_BE_ARRAY_OF_ARRAY))) { - return 1; + return true; } - return 0; + return false; case ZEND_FETCH_DIM_W: case ZEND_FETCH_LIST_W: if (t1 & (MAY_BE_FALSE|MAY_BE_TRUE|MAY_BE_LONG|MAY_BE_DOUBLE|MAY_BE_STRING|MAY_BE_OBJECT|MAY_BE_RESOURCE|MAY_BE_REF)) { - return 1; + return true; } if (t2 & MAY_BE_THROWING_KEY) { - return 1; + return true; } if (opline->op2_type == IS_UNUSED) { - return 1; + return true; } - return 0; + return false; case ZEND_YIELD_FROM: { uint32_t t1 = OP1_INFO(); if ((t1 & (MAY_BE_ANY|MAY_BE_UNDEF)) == MAY_BE_ARRAY && MAY_BE_EMPTY_ONLY(t1)) { @@ -5383,7 +5383,7 @@ ZEND_API bool zend_may_throw_ex(const zend_op *opline, const zend_ssa_op *ssa_op return true; } default: - return 1; + return true; } } diff --git a/Zend/Optimizer/zend_ssa.h b/Zend/Optimizer/zend_ssa.h index ee9faf9bfd23..4f212656fccf 100644 --- a/Zend/Optimizer/zend_ssa.h +++ b/Zend/Optimizer/zend_ssa.h @@ -230,7 +230,7 @@ static zend_always_inline bool zend_ssa_is_no_val_use(const zend_op *opline, con && opline->opcode != ZEND_ADD_ARRAY_UNPACK) { return ssa_op->op1_use != var && ssa_op->op2_use != var; } - return 0; + return false; } static zend_always_inline void zend_ssa_rename_defs_of_instr(zend_ssa *ssa, zend_ssa_op *ssa_op) { diff --git a/Zend/zend.c b/Zend/zend.c index 23265f3818d4..f59ba5f9080b 100644 --- a/Zend/zend.c +++ b/Zend/zend.c @@ -459,10 +459,10 @@ static void print_flat_hash(smart_str *buf, HashTable *ht) /* {{{ */ ZEND_API bool zend_make_printable_zval(zval *expr, zval *expr_copy) /* {{{ */ { if (Z_TYPE_P(expr) == IS_STRING) { - return 0; + return false; } else { ZVAL_STR(expr_copy, zval_get_string_func(expr)); - return 1; + return true; } } /* }}} */ diff --git a/Zend/zend_API.c b/Zend/zend_API.c index 81991a1e8385..908a6ae60f90 100644 --- a/Zend/zend_API.c +++ b/Zend/zend_API.c @@ -619,10 +619,10 @@ ZEND_API bool ZEND_FASTCALL zend_parse_arg_long_weak(const zval *arg, zend_long { if (EXPECTED(Z_TYPE_P(arg) == IS_DOUBLE)) { if (UNEXPECTED(zend_isnan(Z_DVAL_P(arg)))) { - return 0; + return false; } if (UNEXPECTED(!ZEND_DOUBLE_FITS_LONG(Z_DVAL_P(arg)))) { - return 0; + return false; } else { zend_long lval = zend_dval_to_lval(Z_DVAL_P(arg)); if (UNEXPECTED(!zend_is_long_compatible(Z_DVAL_P(arg), lval))) { @@ -632,7 +632,7 @@ ZEND_API bool ZEND_FASTCALL zend_parse_arg_long_weak(const zval *arg, zend_long zend_incompatible_double_to_long_error(Z_DVAL_P(arg)); } if (UNEXPECTED(EG(exception))) { - return 0; + return false; } } *dest = lval; @@ -645,10 +645,10 @@ ZEND_API bool ZEND_FASTCALL zend_parse_arg_long_weak(const zval *arg, zend_long if (EXPECTED(type != 0)) { zend_long lval; if (UNEXPECTED(zend_isnan(d))) { - return 0; + return false; } if (UNEXPECTED(!ZEND_DOUBLE_FITS_LONG(d))) { - return 0; + return false; } lval = zend_dval_to_lval(d); @@ -660,32 +660,32 @@ ZEND_API bool ZEND_FASTCALL zend_parse_arg_long_weak(const zval *arg, zend_long zend_incompatible_string_to_long_error(Z_STR_P(arg)); } if (UNEXPECTED(EG(exception))) { - return 0; + return false; } } *dest = lval; } else { - return 0; + return false; } } } else if (EXPECTED(Z_TYPE_P(arg) < IS_TRUE)) { if (UNEXPECTED(Z_TYPE_P(arg) == IS_NULL) && !zend_null_arg_deprecated("int", arg_num)) { - return 0; + return false; } *dest = 0; } else if (EXPECTED(Z_TYPE_P(arg) == IS_TRUE)) { *dest = 1; } else { - return 0; + return false; } - return 1; + return true; } /* }}} */ ZEND_API bool ZEND_FASTCALL zend_parse_arg_long_slow(const zval *arg, zend_long *dest, uint32_t arg_num) /* {{{ */ { if (UNEXPECTED(ZEND_ARG_USES_STRICT_TYPES())) { - return 0; + return false; } return zend_parse_arg_long_weak(arg, dest, arg_num); } @@ -694,7 +694,7 @@ ZEND_API bool ZEND_FASTCALL zend_parse_arg_long_slow(const zval *arg, zend_long ZEND_API bool ZEND_FASTCALL zend_flf_parse_arg_long_slow(const zval *arg, zend_long *dest, uint32_t arg_num) { if (UNEXPECTED(ZEND_FLF_ARG_USES_STRICT_TYPES())) { - return 0; + return false; } return zend_parse_arg_long_weak(arg, dest, arg_num); } @@ -745,7 +745,7 @@ ZEND_API double ZEND_FASTCALL zend_parse_arg_double_slow(const zval *arg, uint32 ZEND_API bool ZEND_FASTCALL zend_parse_arg_number_slow(zval *arg, zval **dest, uint32_t arg_num) /* {{{ */ { if (UNEXPECTED(ZEND_ARG_USES_STRICT_TYPES())) { - return 0; + return false; } if (Z_TYPE_P(arg) == IS_STRING) { zend_string *str = Z_STR_P(arg); @@ -757,21 +757,21 @@ ZEND_API bool ZEND_FASTCALL zend_parse_arg_number_slow(zval *arg, zval **dest, u } else if (type == IS_DOUBLE) { ZVAL_DOUBLE(arg, dval); } else { - return 0; + return false; } zend_string_release(str); } else if (Z_TYPE_P(arg) < IS_TRUE) { if (UNEXPECTED(Z_TYPE_P(arg) == IS_NULL) && !zend_null_arg_deprecated("int|float", arg_num)) { - return 0; + return false; } ZVAL_LONG(arg, 0); } else if (Z_TYPE_P(arg) == IS_TRUE) { ZVAL_LONG(arg, 1); } else { - return 0; + return false; } *dest = arg; - return 1; + return true; } /* }}} */ @@ -852,17 +852,17 @@ ZEND_API bool ZEND_FASTCALL zend_parse_arg_str_or_long_slow(zval *arg, zend_stri { zend_string *str; if (UNEXPECTED(ZEND_ARG_USES_STRICT_TYPES())) { - return 0; + return false; } if (zend_parse_arg_long_weak(arg, dest_long, arg_num)) { *dest_str = NULL; - return 1; + return true; } else if ((str = zend_parse_arg_str_weak(arg, arg_num)) != NULL) { *dest_long = 0; *dest_str = str; - return 1; + return true; } else { - return 0; + return false; } } /* }}} */ @@ -3851,7 +3851,7 @@ static zend_always_inline bool zend_is_method_callable(zend_string *callable, co if (colon == ZSTR_VAL(callable)) { if (error) *error = estrdup("invalid function name"); - return 0; + return false; } /* This is a compound name. @@ -3882,7 +3882,7 @@ static zend_always_inline bool zend_is_method_callable(zend_string *callable, co strict_class = true; } else if (!zend_is_callable_check_class(class_name, scope, frame, fcc, &strict_class, error, suppress_deprecation || ce_org != NULL)) { zend_string_release_ex(class_name, 0); - return 0; + return false; } zend_string_release_ex(class_name, 0); @@ -3890,7 +3890,7 @@ static zend_always_inline bool zend_is_method_callable(zend_string *callable, co if (ce_org && !instanceof_function(ce_org, fcc->calling_scope)) { // NOT using %pS, see above if (error) zend_spprintf(error, 0, "class %s is not a subclass of %s", ZSTR_VAL(ce_org->name), ZSTR_VAL(fcc->calling_scope->name)); - return 0; + return false; } if (ce_org && !suppress_deprecation) { // Can use %pS here since this message isn't stored in the `error` @@ -3911,7 +3911,7 @@ static zend_always_inline bool zend_is_method_callable(zend_string *callable, co // NOT using %pS, see above zend_spprintf(error, 0, "function \"%s\" not found or invalid function name", ZSTR_VAL(callable)); } - return 0; + return false; } zend_string *lmname = zend_string_tolower(mname); @@ -4166,35 +4166,35 @@ ZEND_API bool zend_is_callable_at_frame( { if (zend_hash_num_elements(Z_ARRVAL_P(callable)) != 2) { if (error) *error = estrdup("array callback must have exactly two members"); - return 0; + return false; } zval *obj = zend_hash_index_find(Z_ARRVAL_P(callable), 0); zval *method = zend_hash_index_find(Z_ARRVAL_P(callable), 1); if (!obj || !method) { if (error) *error = estrdup("array callback has to contain indices 0 and 1"); - return 0; + return false; } ZVAL_DEREF(obj); if (Z_TYPE_P(obj) != IS_STRING && Z_TYPE_P(obj) != IS_OBJECT) { if (error) *error = estrdup("first array member is not a valid class name or object"); - return 0; + return false; } ZVAL_DEREF(method); if (Z_TYPE_P(method) != IS_STRING) { if (error) *error = estrdup("second array member is not a valid method"); - return 0; + return false; } if (Z_TYPE_P(obj) == IS_STRING) { if (check_flags & IS_CALLABLE_CHECK_SYNTAX_ONLY) { - return 1; + return true; } if (!zend_is_callable_check_class(Z_STR_P(obj), get_scope(frame), frame, fcc, &strict_class, error, check_flags & IS_CALLABLE_SUPPRESS_DEPRECATIONS)) { - return 0; + return false; } } else { ZEND_ASSERT(Z_TYPE_P(obj) == IS_OBJECT); @@ -4203,7 +4203,7 @@ ZEND_API bool zend_is_callable_at_frame( if (check_flags & IS_CALLABLE_CHECK_SYNTAX_ONLY) { fcc->called_scope = fcc->calling_scope; - return 1; + return true; } } @@ -4225,7 +4225,7 @@ ZEND_API bool zend_is_callable_at_frame( goto again; default: if (error) *error = estrdup("no array or string given"); - return 0; + return false; } if (fcc == &fcc_local) { @@ -5207,11 +5207,11 @@ ZEND_API bool zend_is_iterable(const zval *iterable) /* {{{ */ { switch (Z_TYPE_P(iterable)) { case IS_ARRAY: - return 1; + return true; case IS_OBJECT: return zend_class_implements_interface(Z_OBJCE_P(iterable), zend_ce_traversable); default: - return 0; + return false; } } /* }}} */ diff --git a/Zend/zend_API.h b/Zend/zend_API.h index 2f2e4adf300c..be941e94d9e6 100644 --- a/Zend/zend_API.h +++ b/Zend/zend_API.h @@ -2277,7 +2277,7 @@ static zend_always_inline bool zend_parse_arg_bool_ex(const zval *arg, bool *des } *dest = result; } - return 1; + return true; } static zend_always_inline bool zend_parse_arg_bool(const zval *arg, bool *dest, bool *is_null, bool check_null, uint32_t arg_num) @@ -2302,7 +2302,7 @@ static zend_always_inline bool zend_parse_arg_long_ex(zval *arg, zend_long *dest return zend_parse_arg_long_slow(arg, dest, arg_num); } } - return 1; + return true; } static zend_always_inline bool zend_parse_arg_long(zval *arg, zend_long *dest, bool *is_null, bool check_null, uint32_t arg_num) @@ -2324,7 +2324,7 @@ static zend_always_inline bool zend_parse_arg_double(const zval *arg, double *de *dest = zend_parse_arg_double_slow(arg, arg_num); return !zend_isnan(*dest); } - return 1; + return true; } static zend_always_inline bool zend_parse_arg_number(zval *arg, zval **dest, bool check_null, uint32_t arg_num) @@ -2336,7 +2336,7 @@ static zend_always_inline bool zend_parse_arg_number(zval *arg, zval **dest, boo } else { return zend_parse_arg_number_slow(arg, dest, arg_num); } - return 1; + return true; } static zend_always_inline bool zend_parse_arg_number_or_str(zval *arg, zval **dest, bool check_null, uint32_t arg_num) @@ -2378,7 +2378,7 @@ static zend_always_inline bool zend_parse_arg_string(zval *arg, char **dest, siz zend_string *str; if (!zend_parse_arg_str(arg, &str, check_null, arg_num)) { - return 0; + return false; } if (check_null && UNEXPECTED(!str)) { *dest = NULL; @@ -2387,16 +2387,16 @@ static zend_always_inline bool zend_parse_arg_string(zval *arg, char **dest, siz *dest = ZSTR_VAL(str); *dest_len = ZSTR_LEN(str); } - return 1; + return true; } static zend_always_inline bool zend_parse_arg_path_str(zval *arg, zend_string **dest, bool check_null, uint32_t arg_num) { if (!zend_parse_arg_str(arg, dest, check_null, arg_num) || (*dest && UNEXPECTED(zend_str_has_nul_byte(*dest)))) { - return 0; + return false; } - return 1; + return true; } static zend_always_inline bool zend_parse_arg_path(zval *arg, char **dest, size_t *dest_len, bool check_null, uint32_t arg_num) @@ -2404,7 +2404,7 @@ static zend_always_inline bool zend_parse_arg_path(zval *arg, char **dest, size_ zend_string *str; if (!zend_parse_arg_path_str(arg, &str, check_null, arg_num)) { - return 0; + return false; } if (check_null && UNEXPECTED(!str)) { *dest = NULL; @@ -2413,22 +2413,22 @@ static zend_always_inline bool zend_parse_arg_path(zval *arg, char **dest, size_ *dest = ZSTR_VAL(str); *dest_len = ZSTR_LEN(str); } - return 1; + return true; } static zend_always_inline bool zend_parse_arg_iterable(zval *arg, zval **dest, bool check_null) { if (EXPECTED(zend_is_iterable(arg))) { *dest = arg; - return 1; + return true; } if (check_null && EXPECTED(Z_TYPE_P(arg) == IS_NULL)) { *dest = NULL; - return 1; + return true; } - return 0; + return false; } static zend_always_inline bool zend_parse_arg_array(zval *arg, zval **dest, bool check_null, bool or_object) @@ -2439,9 +2439,9 @@ static zend_always_inline bool zend_parse_arg_array(zval *arg, zval **dest, bool } else if (check_null && EXPECTED(Z_TYPE_P(arg) == IS_NULL)) { *dest = NULL; } else { - return 0; + return false; } - return 1; + return true; } static zend_always_inline bool zend_parse_arg_array_ht(const zval *arg, HashTable **dest, bool check_null, bool or_object, bool separate) @@ -2462,9 +2462,9 @@ static zend_always_inline bool zend_parse_arg_array_ht(const zval *arg, HashTabl } else if (check_null && EXPECTED(Z_TYPE_P(arg) == IS_NULL)) { *dest = NULL; } else { - return 0; + return false; } - return 1; + return true; } static zend_always_inline bool zend_parse_arg_array_ht_or_long( @@ -2487,7 +2487,7 @@ static zend_always_inline bool zend_parse_arg_array_ht_or_long( return zend_parse_arg_long_slow(arg, dest_long, arg_num); } - return 1; + return true; } static zend_always_inline bool zend_parse_arg_object(zval *arg, zval **dest, zend_class_entry *ce, bool check_null) @@ -2498,9 +2498,9 @@ static zend_always_inline bool zend_parse_arg_object(zval *arg, zval **dest, zen } else if (check_null && EXPECTED(Z_TYPE_P(arg) == IS_NULL)) { *dest = NULL; } else { - return 0; + return false; } - return 1; + return true; } static zend_always_inline bool zend_parse_arg_obj(const zval *arg, zend_object **dest, zend_class_entry *ce, bool check_null) @@ -2511,9 +2511,9 @@ static zend_always_inline bool zend_parse_arg_obj(const zval *arg, zend_object * } else if (check_null && EXPECTED(Z_TYPE_P(arg) == IS_NULL)) { *dest = NULL; } else { - return 0; + return false; } - return 1; + return true; } static zend_always_inline bool zend_parse_arg_obj_or_long( @@ -2536,7 +2536,7 @@ static zend_always_inline bool zend_parse_arg_obj_or_long( return zend_parse_arg_long_slow(arg, dest_long, arg_num); } - return 1; + return true; } static zend_always_inline bool zend_parse_arg_resource(zval *arg, zval **dest, bool check_null) @@ -2546,9 +2546,9 @@ static zend_always_inline bool zend_parse_arg_resource(zval *arg, zval **dest, b } else if (check_null && EXPECTED(Z_TYPE_P(arg) == IS_NULL)) { *dest = NULL; } else { - return 0; + return false; } - return 1; + return true; } static zend_always_inline bool zend_parse_arg_func(const zval *arg, zend_fcall_info *dest_fci, zend_fcall_info_cache *dest_fcc, bool check_null, char **error, bool free_trampoline) @@ -2558,7 +2558,7 @@ static zend_always_inline bool zend_parse_arg_func(const zval *arg, zend_fcall_i dest_fcc->function_handler = NULL; *error = NULL; } else if (UNEXPECTED(zend_fcall_info_init(arg, 0, dest_fci, dest_fcc, NULL, error) != SUCCESS)) { - return 0; + return false; } if (free_trampoline) { /* Release call trampolines: The function may not get called, in which case @@ -2566,7 +2566,7 @@ static zend_always_inline bool zend_parse_arg_func(const zval *arg, zend_fcall_i * zend_call_function instead. */ zend_release_fcall_info_cache(dest_fcc); } - return 1; + return true; } static zend_always_inline void zend_parse_arg_zval(zval *arg, zval **dest, bool check_null) @@ -2599,7 +2599,7 @@ static zend_always_inline bool zend_parse_arg_array_ht_or_str( *dest_str = zend_parse_arg_str_slow(arg, arg_num); return *dest_str != NULL; } - return 1; + return true; } static zend_always_inline bool zend_parse_arg_str_or_long(zval *arg, zend_string **dest_str, zend_long *dest_long, @@ -2619,7 +2619,7 @@ static zend_always_inline bool zend_parse_arg_str_or_long(zval *arg, zend_string } else { return zend_parse_arg_str_or_long_slow(arg, dest_str, dest_long, arg_num); } - return 1; + return true; } static zend_always_inline bool zend_parse_arg_obj_or_class_name( @@ -2634,10 +2634,10 @@ static zend_always_inline bool zend_parse_arg_obj_or_class_name( } else if (allow_null && EXPECTED(Z_TYPE_P(arg) == IS_NULL)) { *destination = NULL; } else { - return 0; + return false; } - return 1; + return true; } static zend_always_inline bool zend_parse_arg_obj_or_str( @@ -2647,7 +2647,7 @@ static zend_always_inline bool zend_parse_arg_obj_or_str( if (!base_ce || EXPECTED(instanceof_function(Z_OBJCE_P(arg), base_ce))) { *destination_object = Z_OBJ_P(arg); *destination_string = NULL; - return 1; + return true; } } diff --git a/Zend/zend_alloc.c b/Zend/zend_alloc.c index a13bcef09740..2c338f8c175b 100644 --- a/Zend/zend_alloc.c +++ b/Zend/zend_alloc.c @@ -2931,10 +2931,10 @@ ZEND_API bool is_zend_ptr(const void *ptr) zend_ulong h = ((uintptr_t) ptr) >> ZEND_MM_ALIGNMENT_LOG2; zval *size_zv = zend_hash_index_find(AG(mm_heap)->tracked_allocs, h); if (size_zv) { - return 1; + return true; } } - return 0; + return false; } #endif @@ -2944,7 +2944,7 @@ ZEND_API bool is_zend_ptr(const void *ptr) do { if (ptr >= (void*)chunk && ptr < (void*)((char*)chunk + ZEND_MM_CHUNK_SIZE)) { - return 1; + return true; } chunk = chunk->next; } while (chunk != AG(mm_heap)->main_chunk); @@ -2954,12 +2954,12 @@ ZEND_API bool is_zend_ptr(const void *ptr) while (block) { if (ptr >= block->ptr && ptr < (void*)((char*)block->ptr + block->size)) { - return 1; + return true; } block = block->next; } - return 0; + return false; } #if !ZEND_DEBUG && defined(HAVE_BUILTIN_CONSTANT_P) @@ -3863,7 +3863,7 @@ ZEND_API bool zend_mm_is_custom_heap(zend_mm_heap *new_heap) #if ZEND_MM_CUSTOM return AG(mm_heap)->use_custom_heap; #else - return 0; + return false; #endif } diff --git a/Zend/zend_attributes.c b/Zend/zend_attributes.c index 3ed8739c3ed6..47f794e1814f 100644 --- a/Zend/zend_attributes.c +++ b/Zend/zend_attributes.c @@ -464,12 +464,12 @@ ZEND_API bool zend_is_attribute_repeated(const HashTable *attributes, const zend ZEND_HASH_PACKED_FOREACH_PTR(attributes, other) { if (other != attr && other->offset == attr->offset) { if (zend_string_equals(other->lcname, attr->lcname)) { - return 1; + return true; } } } ZEND_HASH_FOREACH_END(); - return 0; + return false; } static void attr_free(zval *v) diff --git a/Zend/zend_bitset.h b/Zend/zend_bitset.h index 877f2aaabc05..e12a6d3f0da3 100644 --- a/Zend/zend_bitset.h +++ b/Zend/zend_bitset.h @@ -150,10 +150,10 @@ static inline bool zend_bitset_empty(zend_bitset set, uint32_t len) uint32_t i; for (i = 0; i < len; i++) { if (set[i]) { - return 0; + return false; } } - return 1; + return true; } static inline void zend_bitset_fill(zend_bitset set, uint32_t len) @@ -222,10 +222,10 @@ static inline bool zend_bitset_subset(zend_bitset set1, zend_bitset set2, uint32 for (i = 0; i < len; i++) { if (set1[i] & ~set2[i]) { - return 0; + return false; } } - return 1; + return true; } static inline int zend_bitset_first(zend_bitset set, uint32_t len) diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index c4fc6ee15b66..6816edbc17b6 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -301,11 +301,11 @@ static zend_always_inline bool zend_is_confusable_type(const zend_string *name, for (; info->name; ++info) { if (zend_string_equals_cstr(name, info->name, info->name_len)) { *correct_name = info->correct_name; - return 1; + return true; } } - return 0; + return false; } /* }}} */ @@ -1668,11 +1668,11 @@ static bool can_ct_eval_const(const zend_constant *c) { } if (Z_TYPE(c->value) < IS_ARRAY && !(CG(compiler_options) & ZEND_COMPILE_NO_CONSTANT_SUBSTITUTION)) { - return 1; + return true; } else if (Z_TYPE(c->value) == IS_ARRAY && !(CG(compiler_options) & ZEND_COMPILE_NO_CONSTANT_SUBSTITUTION) && array_is_const(Z_ARR(c->value))) { - return 1; + return true; } return false; } @@ -1836,21 +1836,21 @@ static bool zend_try_compile_const_expr_resolve_class_name(zval *zv, zend_ast *c static bool zend_verify_ct_const_access(const zend_class_constant *c, const zend_class_entry *scope) { if (ZEND_CLASS_CONST_FLAGS(c) & ZEND_ACC_DEPRECATED) { - return 0; + return false; } else if (c->ce->ce_flags & ZEND_ACC_TRAIT) { /* This condition is only met on directly accessing trait constants, * because the ce is replaced to the class entry of the composing class * on binding. */ - return 0; + return false; } else if (ZEND_CLASS_CONST_FLAGS(c) & ZEND_ACC_PUBLIC) { - return 1; + return true; } else if (ZEND_CLASS_CONST_FLAGS(c) & ZEND_ACC_PRIVATE) { return c->ce == scope; } else { zend_class_entry *ce = c->ce; while (1) { if (ce == scope) { - return 1; + return true; } if (!ce->parent) { break; @@ -1865,7 +1865,7 @@ static bool zend_verify_ct_const_access(const zend_class_constant *c, const zend } } /* Reverse case cannot be true during compilation */ - return 0; + return false; } } @@ -1882,10 +1882,10 @@ static bool zend_try_ct_eval_class_const(zval *zv, zend_string *class_name, zend if (ce) { cc = zend_hash_find_ptr(&ce->constants_table, name); } else { - return 0; + return false; } } else { - return 0; + return false; } if (CG(compiler_options) & ZEND_COMPILE_NO_PERSISTENT_CONSTANT_SUBSTITUTION) { @@ -1901,10 +1901,10 @@ static bool zend_try_ct_eval_class_const(zval *zv, zend_string *class_name, zend /* Substitute case-sensitive (or lowercase) persistent class constants */ if (Z_TYPE_P(c) < IS_ARRAY) { ZVAL_COPY_OR_DUP(zv, c); - return 1; + return true; } else if (Z_TYPE_P(c) == IS_ARRAY && array_is_const(Z_ARR_P(c))) { ZVAL_COPY_OR_DUP(zv, c); - return 1; + return true; } return false; @@ -2385,9 +2385,9 @@ ZEND_API bool zend_is_smart_branch(const zend_op *opline) /* {{{ */ case ZEND_DEFINED: case ZEND_IN_ARRAY: case ZEND_ARRAY_KEY_EXISTS: - return 1; + return true; default: - return 0; + return false; } } /* }}} */ @@ -6246,7 +6246,7 @@ static bool zend_handle_loops_and_finally_ex(zend_long depth, znode *return_valu /* Stack separator */ break; } else if (depth <= 1) { - return 1; + return true; } else if (loop_var->opcode == ZEND_NOP) { /* Loop doesn't have freeable variable */ depth--; @@ -6283,13 +6283,13 @@ static bool zend_has_finally_ex(zend_long depth) /* {{{ */ base = zend_stack_base(&CG(loop_var_stack)); for (; loop_var >= base; loop_var--) { if (loop_var->opcode == ZEND_FAST_CALL) { - return 1; + return true; } else if (loop_var->opcode == ZEND_DISCARD_EXCEPTION) { } else if (loop_var->opcode == ZEND_RETURN) { /* Stack separator */ - return 0; + return false; } else if (depth <= 1) { - return 0; + return false; } else { depth--; } @@ -10700,7 +10700,7 @@ static bool zend_try_ct_eval_magic_const(zval *zv, const zend_ast *ast) /* {{{ * case T_CLASS_C: if (ce) { if ((ce->ce_flags & ZEND_ACC_TRAIT) != 0) { - return 0; + return false; } else { ZVAL_STR_COPY(zv, ce->name); } @@ -10762,67 +10762,67 @@ ZEND_API bool zend_binary_op_produces_error(uint32_t opcode, const zval *op1, co || opcode == ZEND_POW || opcode == ZEND_MOD || opcode == ZEND_SL || opcode == ZEND_SR || opcode == ZEND_BW_OR || opcode == ZEND_BW_AND || opcode == ZEND_BW_XOR)) { /* Only the numeric operations throw errors. */ - return 0; + return false; } if (Z_TYPE_P(op1) == IS_ARRAY || Z_TYPE_P(op2) == IS_ARRAY) { if (opcode == ZEND_ADD && Z_TYPE_P(op1) == IS_ARRAY && Z_TYPE_P(op2) == IS_ARRAY) { /* Adding two arrays is allowed. */ - return 0; + return false; } /* Numeric operators throw when one of the operands is an array. */ - return 1; + return true; } /* While basic arithmetic operators always produce numeric string errors, * bitwise operators don't produce errors if both operands are strings */ if ((opcode == ZEND_BW_OR || opcode == ZEND_BW_AND || opcode == ZEND_BW_XOR) && Z_TYPE_P(op1) == IS_STRING && Z_TYPE_P(op2) == IS_STRING) { - return 0; + return false; } if (Z_TYPE_P(op1) == IS_STRING && !is_numeric_string(Z_STRVAL_P(op1), Z_STRLEN_P(op1), NULL, NULL, 0)) { - return 1; + return true; } if (Z_TYPE_P(op2) == IS_STRING && !is_numeric_string(Z_STRVAL_P(op2), Z_STRLEN_P(op2), NULL, NULL, 0)) { - return 1; + return true; } /* Operation which cast float/float-strings to integers might produce incompatible float to int errors */ if (opcode == ZEND_SL || opcode == ZEND_SR || opcode == ZEND_BW_OR || opcode == ZEND_BW_AND || opcode == ZEND_BW_XOR) { if (!zend_is_op_long_compatible(op1) || !zend_is_op_long_compatible(op2)) { - return 1; + return true; } } if (opcode == ZEND_DIV && zval_get_double(op2) == 0.0) { /* Division by zero throws an error. */ - return 1; + return true; } /* Mod is an operation that will cast float/float-strings to integers which might produce float to int incompatible errors, and also cannot be divided by 0 */ if (opcode == ZEND_MOD) { if (!zend_is_op_long_compatible(op1) || !zend_is_op_long_compatible(op2) || zval_get_long(op2) == 0) { - return 1; + return true; } } if ((opcode == ZEND_POW) && zval_get_double(op1) == 0 && zval_get_double(op2) < 0) { /* 0 ** (<0) throws a division by zero error. */ - return 1; + return true; } if ((opcode == ZEND_SL || opcode == ZEND_SR) && zval_get_long(op2) < 0) { /* Shift by negative number throws an error. */ - return 1; + return true; } - return 0; + return false; } /* }}} */ @@ -10843,7 +10843,7 @@ ZEND_API bool zend_unary_op_produces_error(uint32_t opcode, const zval *op) if (opcode == ZEND_BW_NOT) { /* BW_NOT on string does not convert the string into an integer. */ if (Z_TYPE_P(op) == IS_STRING) { - return 0; + return false; } return Z_TYPE_P(op) <= IS_TRUE || !zend_is_op_long_compatible(op); } @@ -10853,7 +10853,7 @@ ZEND_API bool zend_unary_op_produces_error(uint32_t opcode, const zval *op) return Z_TYPE_P(op) == IS_DOUBLE; } - return 0; + return false; } static inline bool zend_try_ct_eval_unary_op(zval *result, uint32_t opcode, zval *op) /* {{{ */ @@ -10954,7 +10954,7 @@ static bool zend_try_ct_eval_array(zval *result, zend_ast *ast) /* {{{ */ zend_hash_update(Z_ARRVAL_P(result), key, val); } else if (!zend_hash_next_index_insert(Z_ARRVAL_P(result), val)) { zval_ptr_dtor(result); - return 0; + return false; } Z_TRY_ADDREF_P(val); } ZEND_HASH_FOREACH_END(); @@ -11002,7 +11002,7 @@ static bool zend_try_ct_eval_array(zval *result, zend_ast *ast) /* {{{ */ fail: zval_ptr_dtor_nogc(value); zval_ptr_dtor(result); - return 0; + return false; } } diff --git a/Zend/zend_compile.h b/Zend/zend_compile.h index e3d62a3ec68c..a258d09c8b32 100644 --- a/Zend/zend_compile.h +++ b/Zend/zend_compile.h @@ -1145,7 +1145,7 @@ static zend_always_inline bool zend_check_arg_send_type(const zend_function *zf, arg_num--; if (UNEXPECTED(arg_num >= zf->common.num_args)) { if (EXPECTED((zf->common.fn_flags & ZEND_ACC_VARIADIC) == 0)) { - return 0; + return false; } arg_num = zf->common.num_args; } diff --git a/Zend/zend_constants.c b/Zend/zend_constants.c index 92221be70d19..99e5a2a6ed69 100644 --- a/Zend/zend_constants.c +++ b/Zend/zend_constants.c @@ -254,7 +254,7 @@ ZEND_API zend_constant *_zend_get_special_const(const char *name, size_t len) /* ZEND_API bool zend_verify_const_access(const zend_class_constant *c, const zend_class_entry *scope) /* {{{ */ { if (ZEND_CLASS_CONST_FLAGS(c) & ZEND_ACC_PUBLIC) { - return 1; + return true; } else if (ZEND_CLASS_CONST_FLAGS(c) & ZEND_ACC_PRIVATE) { return (c->ce == scope); } else { diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c index 7d270c3e249d..70d36ccc0c6f 100644 --- a/Zend/zend_execute.c +++ b/Zend/zend_execute.c @@ -262,9 +262,9 @@ ZEND_API void* zend_vm_stack_extend(size_t size) ZEND_API bool zend_gcc_global_regs(void) { #if defined(HAVE_GCC_GLOBAL_REGS) - return 1; + return true; #else - return 0; + return false; #endif } @@ -835,7 +835,7 @@ ZEND_API bool zend_verify_scalar_type_hint(uint32_t type_mask, zval *arg, bool s if (UNEXPECTED(strict)) { /* SSTH Exception: IS_LONG may be accepted as IS_DOUBLE (converted) */ if (!(type_mask & MAY_BE_DOUBLE) || Z_TYPE_P(arg) != IS_LONG) { - return 0; + return false; } } else if (UNEXPECTED(Z_TYPE_P(arg) == IS_NULL)) { /* NULL may be accepted only by nullable hints (this is already checked). @@ -1056,12 +1056,12 @@ static zend_always_inline bool i_zend_check_property_type(const zend_property_in { ZEND_ASSERT(!Z_ISREF_P(property)); if (EXPECTED(ZEND_TYPE_CONTAINS_CODE(info->type, Z_TYPE_P(property)))) { - return 1; + return true; } if (ZEND_TYPE_IS_COMPLEX(info->type) && Z_TYPE_P(property) == IS_OBJECT && zend_check_and_resolve_property_or_class_constant_class_type(info->ce, info->type, Z_OBJCE_P(property))) { - return 1; + return true; } uint32_t type_mask = ZEND_TYPE_FULL_MASK(info->type); @@ -1072,11 +1072,11 @@ static zend_always_inline bool i_zend_check_property_type(const zend_property_in static zend_always_inline bool i_zend_verify_property_type(const zend_property_info *info, zval *property, bool strict) { if (i_zend_check_property_type(info, property, strict)) { - return 1; + return true; } zend_verify_property_type_error(info, property); - return 0; + return false; } ZEND_API bool zend_never_inline zend_verify_property_type(const zend_property_info *info, zval *property, bool strict) { @@ -1112,12 +1112,12 @@ static zend_never_inline zval* zend_assign_to_typed_prop(const zend_property_inf static zend_always_inline bool zend_value_instanceof_static(const zval *zv) { if (Z_TYPE_P(zv) != IS_OBJECT) { - return 0; + return false; } zend_class_entry *called_scope = zend_get_called_scope(EG(current_execute_data)); if (!called_scope) { - return 0; + return false; } return instanceof_function(Z_OBJCE_P(zv), called_scope); } @@ -1202,20 +1202,20 @@ static zend_always_inline bool zend_check_type_slow( const uint32_t type_mask = ZEND_TYPE_FULL_MASK(*type); if ((type_mask & MAY_BE_CALLABLE) && zend_is_callable_ex(arg, NULL, is_internal ? IS_CALLABLE_SUPPRESS_DEPRECATIONS : 0, NULL, NULL, NULL)) { - return 1; + return true; } if ((type_mask & MAY_BE_STATIC) && zend_value_instanceof_static(arg)) { - return 1; + return true; } if (ref && ZEND_REF_HAS_TYPE_SOURCES(ref)) { /* We cannot have conversions for typed refs. */ - return 0; + return false; } if (is_internal && current_frame) { /* For internal returns, the type has to match exactly, because we're not * going to check it for non-debug builds, and there will be no chance to * apply coercions. */ - return 0; + return false; } return zend_verify_scalar_type_hint(type_mask, arg, @@ -1238,7 +1238,7 @@ static zend_always_inline bool zend_check_type( } if (EXPECTED(ZEND_TYPE_CONTAINS_CODE(*type, Z_TYPE_P(arg)))) { - return 1; + return true; } return zend_check_type_slow(type, arg, ref, current_frame, is_internal); @@ -1268,10 +1268,10 @@ static zend_always_inline bool zend_verify_recv_arg_type(const zend_function *zf if (ZEND_TYPE_IS_SET(cur_arg_info->type) && UNEXPECTED(!zend_check_type(&cur_arg_info->type, arg, false, false))) { zend_verify_arg_error(zf, cur_arg_info, arg_num, arg); - return 0; + return false; } - return 1; + return true; } static zend_always_inline bool zend_verify_variadic_arg_type( @@ -1280,10 +1280,10 @@ static zend_always_inline bool zend_verify_variadic_arg_type( ZEND_ASSERT(ZEND_TYPE_IS_SET(arg_info->type)); if (UNEXPECTED(!zend_check_type(&arg_info->type, arg, false, false))) { zend_verify_arg_error(zf, arg_info, arg_num, arg); - return 0; + return false; } - return 1; + return true; } static zend_never_inline ZEND_ATTRIBUTE_UNUSED bool zend_verify_internal_arg_types(const zend_function *fbc, zend_execute_data *call) @@ -1304,11 +1304,11 @@ 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, false, /* is_internal */ true))) { - return 0; + return false; } arg++; } - return 1; + return true; } #if ZEND_DEBUG @@ -1319,28 +1319,28 @@ ZEND_API bool zend_internal_call_should_throw(const zend_function *fbc, zend_exe { if (fbc->internal_function.handler == ZEND_FN(pass) || (fbc->internal_function.fn_flags & ZEND_ACC_FAKE_CLOSURE)) { /* Be lenient about the special pass function and about fake closures. */ - return 0; + return false; } if (fbc->common.required_num_args > ZEND_CALL_NUM_ARGS(call)) { /* Required argument not passed. */ - return 1; + return true; } if (fbc->common.num_args < ZEND_CALL_NUM_ARGS(call) && !(fbc->common.fn_flags & ZEND_ACC_VARIADIC)) { /* Too many arguments passed. For internal functions (unlike userland functions), * this should always throw. */ - return 1; + return true; } if ((fbc->common.fn_flags & ZEND_ACC_HAS_TYPE_HINTS) && !zend_verify_internal_arg_types(fbc, call)) { zend_clear_exception(); - return 1; + return true; } - return 0; + return false; } ZEND_API zend_never_inline ZEND_COLD void zend_internal_call_arginfo_violation(const zend_function *fbc) @@ -1496,17 +1496,17 @@ ZEND_API bool zend_verify_internal_return_type(const zend_function *zf, zval *re if (ZEND_TYPE_FULL_MASK(ret_info->type) & MAY_BE_VOID) { if (UNEXPECTED(Z_TYPE_P(ret) != IS_NULL)) { zend_verify_void_return_error(zf, zend_zval_value_name(ret), ""); - return 0; + return false; } - return 1; + return true; } if (UNEXPECTED(!zend_check_type(&ret_info->type, ret, true, /* is_internal */ true))) { zend_verify_internal_return_error(zf, ret); - return 0; + return false; } - return 1; + return true; } #endif @@ -1520,12 +1520,12 @@ static zend_always_inline bool zend_check_class_constant_type(const zend_class_c { ZEND_ASSERT(!Z_ISREF_P(constant)); if (EXPECTED(ZEND_TYPE_CONTAINS_CODE(c->type, Z_TYPE_P(constant)))) { - return 1; + return true; } if (((ZEND_TYPE_PURE_MASK(c->type) & MAY_BE_STATIC) || ZEND_TYPE_IS_COMPLEX(c->type)) && Z_TYPE_P(constant) == IS_OBJECT && zend_check_and_resolve_property_or_class_constant_class_type(c->ce, c->type, Z_OBJCE_P(constant))) { - return 1; + return true; } uint32_t type_mask = ZEND_TYPE_FULL_MASK(c->type); @@ -1537,10 +1537,10 @@ ZEND_API bool zend_never_inline zend_verify_class_constant_type(const zend_class { if (!zend_check_class_constant_type(c, constant)) { zend_verify_class_constant_type_error(c, name, constant); - return 0; + return false; } - return 1; + return true; } static zend_never_inline ZEND_COLD void ZEND_FASTCALL zend_use_object_as_array(const zend_object *object) @@ -3330,9 +3330,9 @@ static zend_never_inline bool ZEND_FASTCALL zend_isset_dim_slow(const zval *cont lval += (zend_long)Z_STRLEN_P(container); } if (EXPECTED(lval >= 0) && (size_t)lval < Z_STRLEN_P(container)) { - return 1; + return true; } else { - return 0; + return false; } } else { /*if (OP2_TYPE & (IS_CV|IS_VAR)) {*/ @@ -3344,10 +3344,10 @@ static zend_never_inline bool ZEND_FASTCALL zend_isset_dim_slow(const zval *cont lval = zval_get_long_ex(offset, /* is_strict */ true); goto str_offset; } - return 0; + return false; } } else { - return 0; + return false; } } @@ -3371,7 +3371,7 @@ static zend_never_inline bool ZEND_FASTCALL zend_isempty_dim_slow(const zval *co if (EXPECTED(lval >= 0) && (size_t)lval < Z_STRLEN_P(container)) { return (Z_STRVAL_P(container)[lval] == '0'); } else { - return 1; + return true; } } else { /*if (OP2_TYPE & (IS_CV|IS_VAR)) {*/ @@ -3383,10 +3383,10 @@ static zend_never_inline bool ZEND_FASTCALL zend_isempty_dim_slow(const zval *co lval = zval_get_long_ex(offset, /* is_strict */ true); goto str_offset; } - return 1; + return true; } } else { - return 1; + return true; } } @@ -3444,7 +3444,7 @@ static zend_never_inline bool ZEND_FASTCALL zend_array_key_exists_fast(HashTable goto str_key; } else { zend_illegal_array_offset_access(key); - return 0; + return false; } } @@ -3470,7 +3470,7 @@ static zend_always_inline bool promotes_to_array(const zval *val) { static zend_always_inline bool check_type_array_assignable(zend_type type) { if (!ZEND_TYPE_IS_SET(type)) { - return 1; + return true; } return (ZEND_TYPE_FULL_MASK(type) & MAY_BE_ARRAY) != 0; } @@ -3482,10 +3482,10 @@ ZEND_API bool zend_verify_ref_array_assignable(zend_reference *ref) { ZEND_REF_FOREACH_TYPE_SOURCES(ref, prop) { if (!check_type_array_assignable(prop->type)) { zend_throw_auto_init_in_ref_error(prop); - return 0; + return false; } } ZEND_REF_FOREACH_TYPE_SOURCES_END(); - return 1; + return true; } static zend_never_inline bool zend_handle_fetch_obj_flags( @@ -3500,7 +3500,7 @@ static zend_never_inline bool zend_handle_fetch_obj_flags( if (!check_type_array_assignable(prop_info->type)) { zend_throw_auto_init_in_prop_error(prop_info); if (result) ZVAL_ERROR(result); - return 0; + return false; } } break; @@ -3513,7 +3513,7 @@ static zend_never_inline bool zend_handle_fetch_obj_flags( if (!ZEND_TYPE_ALLOW_NULL(prop_info->type)) { zend_throw_access_uninit_prop_by_ref_error(prop_info); if (result) ZVAL_ERROR(result); - return 0; + return false; } ZVAL_NULL(ptr); } @@ -3524,7 +3524,7 @@ static zend_never_inline bool zend_handle_fetch_obj_flags( break; default: ZEND_UNREACHABLE(); } - return 1; + return true; } static zend_always_inline void zend_fetch_property_address( @@ -4019,7 +4019,7 @@ ZEND_API bool ZEND_FASTCALL zend_verify_ref_assignable_zval(zend_reference *ref, type_error: zend_throw_ref_type_error_zval(prop, zv); zval_ptr_dtor(&coerced_value); - return 0; + return false; } if (result < 0) { @@ -4056,7 +4056,7 @@ ZEND_API bool ZEND_FASTCALL zend_verify_ref_assignable_zval(zend_reference *ref, conflicting_coercion_error: zend_throw_conflicting_coercion_error(first_prop, prop, zv); zval_ptr_dtor(&coerced_value); - return 0; + return false; } } } ZEND_REF_FOREACH_TYPE_SOURCES_END(); @@ -4066,7 +4066,7 @@ ZEND_API bool ZEND_FASTCALL zend_verify_ref_assignable_zval(zend_reference *ref, ZVAL_COPY_VALUE(zv, &coerced_value); } - return 1; + return true; } static zend_always_inline void i_zval_ptr_dtor_noref(zval *zval_ptr) { @@ -4130,7 +4130,7 @@ ZEND_API bool ZEND_FASTCALL zend_verify_prop_assignable_by_ref_ex(const zend_pro val = Z_REFVAL_P(val); result = i_zend_verify_type_assignable_zval(prop_info, val, strict); if (result > 0) { - return 1; + return true; } if (result < 0) { @@ -4142,14 +4142,14 @@ ZEND_API bool ZEND_FASTCALL zend_verify_prop_assignable_by_ref_ex(const zend_pro const zend_property_info *ref_prop = ZEND_REF_FIRST_SOURCE(Z_REF_P(orig_val)); zend_throw_ref_type_error_type(ref_prop, prop_info, val); zval_ptr_dtor(&tmp); - return 0; + return false; } zval_ptr_dtor(&tmp); } } else { ZVAL_DEREF(val); if (i_zend_check_property_type(prop_info, val, strict)) { - return 1; + return true; } } @@ -4160,7 +4160,7 @@ ZEND_API bool ZEND_FASTCALL zend_verify_prop_assignable_by_ref_ex(const zend_pro zend_magic_get_property_type_inconsistency_error(prop_info, val); } - return 0; + return false; } ZEND_API bool ZEND_FASTCALL zend_verify_prop_assignable_by_ref(const zend_property_info *prop_info, zval *orig_val, bool strict) { @@ -5433,7 +5433,7 @@ static zend_never_inline bool ZEND_FASTCALL zend_fe_reset_iterator(zval *array_p zend_throw_exception_ex(NULL, 0, "Object of type %pS did not create an Iterator", ce->name); } ZVAL_UNDEF(EX_VAR(opline->result.var)); - return 1; + return true; } iter->index = 0; @@ -5442,7 +5442,7 @@ static zend_never_inline bool ZEND_FASTCALL zend_fe_reset_iterator(zval *array_p if (UNEXPECTED(EG(exception) != NULL)) { OBJ_RELEASE(&iter->std); ZVAL_UNDEF(EX_VAR(opline->result.var)); - return 1; + return true; } } @@ -5451,7 +5451,7 @@ static zend_never_inline bool ZEND_FASTCALL zend_fe_reset_iterator(zval *array_p if (UNEXPECTED(EG(exception) != NULL)) { OBJ_RELEASE(&iter->std); ZVAL_UNDEF(EX_VAR(opline->result.var)); - return 1; + return true; } iter->index = -1; /* will be set to 0 before using next handler */ diff --git a/Zend/zend_execute_API.c b/Zend/zend_execute_API.c index a56bc53725bd..50e99501e1c5 100644 --- a/Zend/zend_execute_API.c +++ b/Zend/zend_execute_API.c @@ -1240,10 +1240,10 @@ ZEND_API bool zend_is_valid_class_name(const zend_string *name) { for (size_t i = 0; i < ZSTR_LEN(name); i++) { unsigned char c = ZSTR_VAL(name)[i]; if (!ZEND_BIT_TEST(valid_chars, c)) { - return 0; + return false; } } - return 1; + return true; } ZEND_API zend_class_entry *zend_lookup_class_ex(zend_string *name, zend_string *key, uint32_t flags) /* {{{ */ diff --git a/Zend/zend_gdb.c b/Zend/zend_gdb.c index 0c2a82a144c0..dd42c970dbd1 100644 --- a/Zend/zend_gdb.c +++ b/Zend/zend_gdb.c @@ -64,7 +64,7 @@ ZEND_API bool zend_gdb_register_code(const void *object, size_t size) entry = malloc(sizeof(zend_gdbjit_code_entry) + size); if (entry == NULL) { - return 0; + return false; } entry->symfile_addr = ((char*)entry) + sizeof(zend_gdbjit_code_entry); @@ -85,7 +85,7 @@ ZEND_API bool zend_gdb_register_code(const void *object, size_t size) __jit_debug_descriptor.action_flag = ZEND_GDBJIT_REGISTER; __jit_debug_register_code(); - return 1; + return true; } ZEND_API void zend_gdb_unregister_all(void) diff --git a/Zend/zend_hash.c b/Zend/zend_hash.c index 59be1972cc44..c2711ece7539 100644 --- a/Zend/zend_hash.c +++ b/Zend/zend_hash.c @@ -2526,14 +2526,14 @@ ZEND_ATTRIBUTE_NONNULL static zend_always_inline bool zend_array_dup_value(const data = Z_INDIRECT_P(data); } if (UNEXPECTED(Z_TYPE_INFO_P(data) == IS_UNDEF)) { - return 0; + return false; } } else if (!packed) { /* INDIRECT element may point to UNDEF-ined slots */ if (Z_TYPE_INFO_P(data) == IS_INDIRECT) { data = Z_INDIRECT_P(data); if (UNEXPECTED(Z_TYPE_INFO_P(data) == IS_UNDEF)) { - return 0; + return false; } } } @@ -2553,13 +2553,13 @@ ZEND_ATTRIBUTE_NONNULL static zend_always_inline bool zend_array_dup_value(const } while (0); ZVAL_COPY_VALUE(dest, data); - return 1; + return true; } ZEND_ATTRIBUTE_NONNULL static zend_always_inline bool zend_array_dup_element(const HashTable *source, HashTable *target, uint32_t idx, Bucket *p, Bucket *q, bool packed, bool static_keys, bool with_holes) { if (!zend_array_dup_value(source, &p->val, &q->val, packed, with_holes)) { - return 0; + return false; } if (!packed) { @@ -2575,7 +2575,7 @@ ZEND_ATTRIBUTE_NONNULL static zend_always_inline bool zend_array_dup_element(con Z_NEXT(q->val) = HT_HASH(target, nIndex); HT_HASH(target, nIndex) = HT_IDX_TO_HASH(idx); } - return 1; + return true; } // We need to duplicate iterators to be able to search through all copy-on-write copies to find the actually iterated HashTable and position back @@ -3488,7 +3488,7 @@ ZEND_ATTRIBUTE_NONNULL ZEND_API bool ZEND_FASTCALL _zend_handle_numeric_str_ex(c || (SIZEOF_ZEND_LONG == 4 && end - tmp == MAX_LENGTH_OF_LONG - 1 && *tmp > '2')) { /* overflow */ - return 0; + return false; } *idx = (*tmp - '0'); while (1) { @@ -3496,18 +3496,18 @@ ZEND_ATTRIBUTE_NONNULL ZEND_API bool ZEND_FASTCALL _zend_handle_numeric_str_ex(c if (tmp == end) { if (*key == '-') { if (*idx-1 > ZEND_LONG_MAX) { /* overflow */ - return 0; + return false; } *idx = 0 - *idx; } else if (*idx > ZEND_LONG_MAX) { /* overflow */ - return 0; + return false; } - return 1; + return true; } if (*tmp <= '9' && *tmp >= '0') { *idx = (*idx * 10) + (*tmp - '0'); } else { - return 0; + return false; } } } diff --git a/Zend/zend_language_scanner.l b/Zend/zend_language_scanner.l index 60143bc800fe..f62f41fb0ae3 100644 --- a/Zend/zend_language_scanner.l +++ b/Zend/zend_language_scanner.l @@ -1209,7 +1209,7 @@ static bool strip_multiline_string_indentation( if (!newline_at_start) { nl = next_newline(str, end, &newline_len); if (!nl) { - return 1; + return true; } str = nl + newline_len; @@ -1262,13 +1262,13 @@ static bool strip_multiline_string_indentation( *copy = '\0'; Z_STRLEN_P(zendlval) = copy - Z_STRVAL_P(zendlval); - return 1; + return true; error: zval_ptr_dtor_str(zendlval); ZVAL_UNDEF(zendlval); - return 0; + return false; } static void copy_heredoc_label_stack(void *void_heredoc_label) diff --git a/Zend/zend_object_handlers.c b/Zend/zend_object_handlers.c index 90f8c841b47e..8a9dbeba0edf 100644 --- a/Zend/zend_object_handlers.c +++ b/Zend/zend_object_handlers.c @@ -284,12 +284,12 @@ static zend_always_inline bool is_derived_class(const zend_class_entry *child_cl child_class = child_class->parent; while (child_class) { if (child_class == parent_class) { - return 1; + return true; } child_class = child_class->parent; } - return 0; + return false; } /* }}} */ @@ -346,9 +346,9 @@ static ZEND_COLD zend_never_inline bool zend_deprecated_dynamic_property( zend_throw_error(NULL, "Cannot create dynamic property %pS::$%pS", ce->name, member); } - return 0; + return false; } - return 1; + return true; } static ZEND_COLD zend_never_inline void zend_readonly_property_unset_error( @@ -1786,7 +1786,7 @@ ZEND_API bool zend_check_protected(const zend_class_entry *ce, const zend_class_ */ while (fbc_scope) { if (fbc_scope==scope) { - return 1; + return true; } fbc_scope = fbc_scope->parent; } @@ -1796,11 +1796,11 @@ ZEND_API bool zend_check_protected(const zend_class_entry *ce, const zend_class_ */ while (scope) { if (scope==ce) { - return 1; + return true; } scope = scope->parent; } - return 0; + return false; } /* }}} */ diff --git a/Zend/zend_operators.c b/Zend/zend_operators.c index 00fb66ced5fa..5e83e55bf9e2 100644 --- a/Zend/zend_operators.c +++ b/Zend/zend_operators.c @@ -816,11 +816,11 @@ ZEND_API bool ZEND_FASTCALL _try_convert_to_string(zval *op) /* {{{ */ ZEND_ASSERT(Z_TYPE_P(op) != IS_STRING); str = zval_try_get_string_func(op); if (UNEXPECTED(!str)) { - return 0; + return false; } zval_ptr_dtor(op); ZVAL_STR(op, str); - return 1; + return true; } /* }}} */ @@ -2547,13 +2547,13 @@ static int hash_zval_identical_function(const zval *z1, const zval *z2) /* {{{ * ZEND_API bool ZEND_FASTCALL zend_is_identical(const zval *op1, const zval *op2) /* {{{ */ { if (Z_TYPE_P(op1) != Z_TYPE_P(op2)) { - return 0; + return false; } switch (Z_TYPE_P(op1)) { case IS_NULL: case IS_FALSE: case IS_TRUE: - return 1; + return true; case IS_LONG: return (Z_LVAL_P(op1) == Z_LVAL_P(op2)); case IS_RESOURCE: @@ -2568,7 +2568,7 @@ ZEND_API bool ZEND_FASTCALL zend_is_identical(const zval *op1, const zval *op2) case IS_OBJECT: return (Z_OBJ_P(op1) == Z_OBJ_P(op2)); default: - return 0; + return false; } } /* }}} */ @@ -2624,11 +2624,11 @@ ZEND_API bool ZEND_FASTCALL zend_class_implements_interface(const zend_class_ent ZEND_ASSERT(class_ce->ce_flags & ZEND_ACC_RESOLVED_INTERFACES); for (i = 0; i < class_ce->num_interfaces; i++) { if (class_ce->interfaces[i] == interface_ce) { - return 1; + return true; } } } - return 0; + return false; } /* }}} */ @@ -2642,19 +2642,19 @@ ZEND_API bool ZEND_FASTCALL instanceof_function_slow(const zend_class_entry *ins ZEND_ASSERT(instance_ce->ce_flags & ZEND_ACC_RESOLVED_INTERFACES); for (i = 0; i < instance_ce->num_interfaces; i++) { if (instance_ce->interfaces[i] == ce) { - return 1; + return true; } } } - return 0; + return false; } else { while (1) { instance_ce = instance_ce->parent; if (instance_ce == ce) { - return 1; + return true; } if (instance_ce == NULL) { - return 0; + return false; } } } @@ -3466,12 +3466,12 @@ ZEND_API bool ZEND_FASTCALL zendi_smart_streq(const zend_string *s1, const zend_ if (ret1 != IS_DOUBLE) { if (oflow2) { /* 2nd operand is integer > LONG_MAX (oflow2==1) or < LONG_MIN (-1) */ - return 0; + return false; } dval1 = (double) lval1; } else if (ret2 != IS_DOUBLE) { if (oflow1) { - return 0; + return false; } dval2 = (double) lval2; } else if (dval1 == dval2 && !zend_finite(dval1)) { diff --git a/Zend/zend_operators.h b/Zend/zend_operators.h index 885e6f426e76..1113006bb6fe 100644 --- a/Zend/zend_operators.h +++ b/Zend/zend_operators.h @@ -389,7 +389,7 @@ static zend_always_inline zend_string *zval_try_get_tmp_string(const zval *op, z ZEND_API bool ZEND_FASTCALL _try_convert_to_string(zval *op); static zend_always_inline bool try_convert_to_string(zval *op) { if (Z_TYPE_P(op) == IS_STRING) { - return 1; + return true; } return _try_convert_to_string(op); } @@ -911,7 +911,7 @@ overflow: ZEND_ATTRIBUTE_COLD_LABEL static zend_always_inline bool zend_fast_equal_strings(zend_string *s1, zend_string *s2) { if (s1 == s2) { - return 1; + return true; } else if (ZSTR_VAL(s1)[0] > '9' || ZSTR_VAL(s2)[0] > '9') { return zend_string_equal_content(s1, s2); } else { @@ -960,9 +960,9 @@ static zend_always_inline bool fast_equal_check_string(zval *op1, zval *op2) static zend_always_inline bool fast_is_identical_function(const zval *op1, const zval *op2) { if (Z_TYPE_P(op1) != Z_TYPE_P(op2)) { - return 0; + return false; } else if (Z_TYPE_P(op1) <= IS_TRUE) { - return 1; + return true; } return zend_is_identical(op1, op2); } @@ -970,9 +970,9 @@ static zend_always_inline bool fast_is_identical_function(const zval *op1, const static zend_always_inline bool fast_is_not_identical_function(const zval *op1, const zval *op2) { if (Z_TYPE_P(op1) != Z_TYPE_P(op2)) { - return 1; + return true; } else if (Z_TYPE_P(op1) <= IS_TRUE) { - return 0; + return false; } return !zend_is_identical(op1, op2); } @@ -1026,10 +1026,10 @@ static zend_always_inline bool zend_strnieq(const char *ptr1, const char *ptr2, const char *end = ptr1 + num; while (ptr1 < end) { if (zend_tolower_ascii(*ptr1++) != zend_tolower_ascii(*ptr2++)) { - return 0; + return false; } } - return 1; + return true; } static zend_always_inline const char * diff --git a/ext/com_dotnet/com_misc.c b/ext/com_dotnet/com_misc.c index 2cca9f11ca3c..4b08e09b815e 100644 --- a/ext/com_dotnet/com_misc.c +++ b/ext/com_dotnet/com_misc.c @@ -89,7 +89,7 @@ PHP_COM_DOTNET_API bool php_com_safearray_get_elem(VARIANT *array, VARIANT *dest VARTYPE vt; if (!V_ISARRAY(array)) { - return 0; + return false; } dims = SafeArrayGetDim(V_ARRAY(array)); @@ -98,7 +98,7 @@ PHP_COM_DOTNET_API bool php_com_safearray_get_elem(VARIANT *array, VARIANT *dest /* TODO Promote to ValueError? */ php_error_docref(NULL, E_WARNING, "Can only handle single dimension variant arrays (this array has %d)", dims); - return 0; + return false; } if (FAILED(SafeArrayGetVartype(V_ARRAY(array), &vt)) || vt == VT_EMPTY) { @@ -112,7 +112,7 @@ PHP_COM_DOTNET_API bool php_com_safearray_get_elem(VARIANT *array, VARIANT *dest /* check bounds */ if (dim1 < lbound || dim1 > ubound) { php_com_throw_exception(DISP_E_BADINDEX, "index out of bounds"); - return 0; + return false; } /* now fetch that element */ @@ -130,5 +130,5 @@ PHP_COM_DOTNET_API bool php_com_safearray_get_elem(VARIANT *array, VARIANT *dest SafeArrayGetElement(V_ARRAY(array), indices, &dest->lVal); } - return 1; + return true; } diff --git a/ext/date/php_date.c b/ext/date/php_date.c index 98c0240400c1..d53a31b6603c 100644 --- a/ext/date/php_date.c +++ b/ext/date/php_date.c @@ -2432,7 +2432,7 @@ PHPAPI bool php_date_initialize(php_date_obj *dateobj, const char *time_str, siz if (err && err->error_count) { timelib_time_dtor(dateobj->time); dateobj->time = 0; - return 0; + return false; } if (timezone_object) { @@ -2453,7 +2453,7 @@ PHPAPI bool php_date_initialize(php_date_obj *dateobj, const char *time_str, siz break; default: zend_throw_error(NULL, "The DateTimeZone object has not been correctly initialized by its constructor"); - return 0; + return false; } type = tzobj->type; } else if (dateobj->time->tz_info) { @@ -2461,7 +2461,7 @@ PHPAPI bool php_date_initialize(php_date_obj *dateobj, const char *time_str, siz } else { tzi = get_timezone_info(); if (!tzi) { - return 0; + return false; } } @@ -2489,7 +2489,7 @@ PHPAPI bool php_date_initialize(php_date_obj *dateobj, const char *time_str, siz && memcmp(time_str, "now", sizeof("now") - 1) == 0) { timelib_time_dtor(dateobj->time); dateobj->time = now; - return 1; + return true; } options = TIMELIB_NO_CLONE; @@ -2505,7 +2505,7 @@ PHPAPI bool php_date_initialize(php_date_obj *dateobj, const char *time_str, siz timelib_time_dtor(now); - return 1; + return true; } /* }}} */ PHPAPI void php_date_initialize_from_ts_long(php_date_obj *dateobj, zend_long sec, int usec) /* {{{ */ diff --git a/ext/ffi/ffi.c b/ext/ffi/ffi.c index 160b4db1011d..5b7f916415e1 100644 --- a/ext/ffi/ffi.c +++ b/ext/ffi/ffi.c @@ -270,24 +270,24 @@ static bool zend_ffi_func_ptr_are_compatible(const zend_ffi_type *dst_type, cons /* Ensure calling convention matches */ if (dst_type->func.abi != src_type->func.abi) { - return 0; + return false; } /* Ensure variadic attr matches */ if ((dst_type->attr & ZEND_FFI_ATTR_VARIADIC) != (src_type->attr & ZEND_FFI_ATTR_VARIADIC)) { - return 0; + return false; } /* Ensure same arg count */ dst_argc = dst_type->func.args ? zend_hash_num_elements(dst_type->func.args) : 0; src_argc = src_type->func.args ? zend_hash_num_elements(src_type->func.args) : 0; if (dst_argc != src_argc) { - return 0; + return false; } /* Ensure compatible ret_type */ if (!zend_ffi_is_compatible_type(dst_type->func.ret_type, src_type->func.ret_type)) { - return 0; + return false; } /* Ensure compatible args */ @@ -295,11 +295,11 @@ static bool zend_ffi_func_ptr_are_compatible(const zend_ffi_type *dst_type, cons dst_arg = zend_hash_index_find_ptr(dst_type->func.args, i); src_arg = zend_hash_index_find_ptr(src_type->func.args, i); if (!zend_ffi_is_compatible_type(ZEND_FFI_TYPE(dst_arg), ZEND_FFI_TYPE(src_arg))) { - return 0; + return false; } } - return 1; + return true; } /* }}} */ @@ -307,16 +307,16 @@ static bool zend_ffi_is_compatible_type(const zend_ffi_type *dst_type, const zen { while (1) { if (dst_type == src_type) { - return 1; + return true; } else if (dst_type->kind == src_type->kind) { if (dst_type->kind < ZEND_FFI_TYPE_POINTER) { - return 1; + return true; } else if (dst_type->kind == ZEND_FFI_TYPE_POINTER) { dst_type = ZEND_FFI_TYPE(dst_type->pointer.type); src_type = ZEND_FFI_TYPE(src_type->pointer.type); if (dst_type->kind == ZEND_FFI_TYPE_VOID || src_type->kind == ZEND_FFI_TYPE_VOID) { - return 1; + return true; } else if (dst_type->kind == ZEND_FFI_TYPE_FUNC && src_type->kind == ZEND_FFI_TYPE_FUNC) { return zend_ffi_func_ptr_are_compatible(dst_type, src_type); @@ -334,13 +334,13 @@ static bool zend_ffi_is_compatible_type(const zend_ffi_type *dst_type, const zen dst_type = ZEND_FFI_TYPE(dst_type->pointer.type); src_type = ZEND_FFI_TYPE(src_type->array.type); if (dst_type->kind == ZEND_FFI_TYPE_VOID) { - return 1; + return true; } } else { break; } } - return 0; + return false; } /* }}} */ @@ -1495,20 +1495,20 @@ static bool zend_ffi_ctype_name_prepend(zend_ffi_ctype_name_buf *buf, const char { buf->start -= len; if (buf->start < buf->buf) { - return 0; + return false; } memcpy(buf->start, str, len); - return 1; + return true; } /* }}} */ static bool zend_ffi_ctype_name_append(zend_ffi_ctype_name_buf *buf, const char *str, size_t len) /* {{{ */ { if (buf->end + len > buf->buf + MAX_TYPE_NAME_LEN) { - return 0; + return false; } buf->end = zend_mempcpy(buf->end, str, len); - return 1; + return true; } /* }}} */ @@ -1573,7 +1573,7 @@ static bool zend_ffi_ctype_name(zend_ffi_ctype_name_buf *buf, const zend_ffi_typ break; case ZEND_FFI_TYPE_POINTER: if (!zend_ffi_ctype_name_prepend(buf, "*", 1)) { - return 0; + return false; } is_ptr = true; type = ZEND_FFI_TYPE(type->pointer.type); @@ -1583,12 +1583,12 @@ static bool zend_ffi_ctype_name(zend_ffi_ctype_name_buf *buf, const zend_ffi_typ is_ptr = false; if (!zend_ffi_ctype_name_prepend(buf, "(", 1) || !zend_ffi_ctype_name_append(buf, ")", 1)) { - return 0; + return false; } } if (!zend_ffi_ctype_name_append(buf, "(", 1) || !zend_ffi_ctype_name_append(buf, ")", 1)) { - return 0; + return false; } type = ZEND_FFI_TYPE(type->func.ret_type); break; @@ -1597,26 +1597,26 @@ static bool zend_ffi_ctype_name(zend_ffi_ctype_name_buf *buf, const zend_ffi_typ is_ptr = false; if (!zend_ffi_ctype_name_prepend(buf, "(", 1) || !zend_ffi_ctype_name_append(buf, ")", 1)) { - return 0; + return false; } } if (!zend_ffi_ctype_name_append(buf, "[", 1)) { - return 0; + return false; } if (type->attr & ZEND_FFI_ATTR_VLA) { if (!zend_ffi_ctype_name_append(buf, "*", 1)) { - return 0; + return false; } } else if (!(type->attr & ZEND_FFI_ATTR_INCOMPLETE_ARRAY)) { char str[MAX_LENGTH_OF_LONG + 1]; char *s = zend_print_long_to_buf(str + sizeof(str) - 1, type->array.length); if (!zend_ffi_ctype_name_append(buf, s, strlen(s))) { - return 0; + return false; } } if (!zend_ffi_ctype_name_append(buf, "]", 1)) { - return 0; + return false; } type = ZEND_FFI_TYPE(type->array.type); break; @@ -1647,7 +1647,7 @@ static bool zend_ffi_ctype_name(zend_ffi_ctype_name_buf *buf, const zend_ffi_typ // if (buf->start != buf->end && *buf->start != '[') { // if (!zend_ffi_ctype_name_prepend(buf, " ", 1)) { -// return 0; +// return false; // } // } return zend_ffi_ctype_name_prepend(buf, name, strlen(name)); @@ -2227,16 +2227,16 @@ static bool zend_ffi_is_same_type(const zend_ffi_type *type1, const zend_ffi_typ { while (1) { if (type1 == type2) { - return 1; + return true; } else if (type1->kind == type2->kind) { if (type1->kind < ZEND_FFI_TYPE_POINTER) { - return 1; + return true; } else if (type1->kind == ZEND_FFI_TYPE_POINTER) { type1 = ZEND_FFI_TYPE(type1->pointer.type); type2 = ZEND_FFI_TYPE(type2->pointer.type); if (type1->kind == ZEND_FFI_TYPE_VOID || type2->kind == ZEND_FFI_TYPE_VOID) { - return 1; + return true; } } else if (type1->kind == ZEND_FFI_TYPE_ARRAY && type1->array.length == type2->array.length) { @@ -2249,7 +2249,7 @@ static bool zend_ffi_is_same_type(const zend_ffi_type *type1, const zend_ffi_typ break; } } - return 0; + return false; } /* }}} */ @@ -2994,10 +2994,10 @@ static zend_always_inline bool zend_ffi_validate_api_restriction(const zend_exec || (execute_data->prev_execute_data && (execute_data->prev_execute_data->func->common.fn_flags & ZEND_ACC_PRELOADED)) || (CG(compiler_options) & ZEND_COMPILE_PRELOAD)) { - return 1; + return true; } } else if (EXPECTED(FFI_G(restriction) == ZEND_FFI_ENABLED)) { - return 1; + return true; } return zend_ffi_disabled(); } @@ -3153,14 +3153,14 @@ ZEND_METHOD(FFI, cdef) /* {{{ */ static bool zend_ffi_same_types(const zend_ffi_type *old, const zend_ffi_type *type) /* {{{ */ { if (old == type) { - return 1; + return true; } if (old->kind != type->kind || old->size != type->size || old->align != type->align || old->attr != type->attr) { - return 0; + return false; } switch (old->kind) { @@ -3173,7 +3173,7 @@ static bool zend_ffi_same_types(const zend_ffi_type *old, const zend_ffi_type *t return zend_ffi_same_types(ZEND_FFI_TYPE(old->pointer.type), ZEND_FFI_TYPE(type->pointer.type)); case ZEND_FFI_TYPE_STRUCT: if (zend_hash_num_elements(&old->record.fields) != zend_hash_num_elements(&type->record.fields)) { - return 0; + return false; } else { zend_ffi_field *old_field, *field; zend_string *key; @@ -3186,10 +3186,10 @@ static bool zend_ffi_same_types(const zend_ffi_type *old, const zend_ffi_type *t if (key) { if (!b->key || !zend_string_equals(key, b->key)) { - return 0; + return false; } } else if (b->key) { - return 0; + return false; } field = Z_PTR(b->val); if (old_field->offset != field->offset @@ -3198,7 +3198,7 @@ static bool zend_ffi_same_types(const zend_ffi_type *old, const zend_ffi_type *t || old_field->first_bit != field->first_bit || old_field->bits != field->bits || !zend_ffi_same_types(ZEND_FFI_TYPE(old_field->type), ZEND_FFI_TYPE(field->type))) { - return 0; + return false; } b++; } ZEND_HASH_FOREACH_END(); @@ -3208,7 +3208,7 @@ static bool zend_ffi_same_types(const zend_ffi_type *old, const zend_ffi_type *t if (old->func.abi != type->func.abi || ((old->func.args ? zend_hash_num_elements(old->func.args) : 0) != (type->func.args ? zend_hash_num_elements(type->func.args) : 0)) || !zend_ffi_same_types(ZEND_FFI_TYPE(old->func.ret_type), ZEND_FFI_TYPE(type->func.ret_type))) { - return 0; + return false; } else if (old->func.args) { zend_ffi_type *arg_type; const zval *zv = type->func.args->arPacked; @@ -3218,7 +3218,7 @@ static bool zend_ffi_same_types(const zend_ffi_type *old, const zend_ffi_type *t zv++; } if (!zend_ffi_same_types(ZEND_FFI_TYPE(arg_type), ZEND_FFI_TYPE(Z_PTR_P(zv)))) { - return 0; + return false; } zv++; } ZEND_HASH_FOREACH_END(); @@ -3228,19 +3228,19 @@ static bool zend_ffi_same_types(const zend_ffi_type *old, const zend_ffi_type *t break; } - return 1; + return true; } /* }}} */ static bool zend_ffi_same_symbols(const zend_ffi_symbol *old, const zend_ffi_symbol *sym) /* {{{ */ { if (old->kind != sym->kind || old->is_const != sym->is_const) { - return 0; + return false; } if (old->kind == ZEND_FFI_SYM_CONST) { if (old->value != sym->value) { - return 0; + return false; } } @@ -3251,7 +3251,7 @@ static bool zend_ffi_same_symbols(const zend_ffi_symbol *old, const zend_ffi_sym static bool zend_ffi_same_tags(const zend_ffi_tag *old, const zend_ffi_tag *tag) /* {{{ */ { if (old->kind != tag->kind) { - return 0; + return false; } return zend_ffi_same_types(ZEND_FFI_TYPE(old->type), ZEND_FFI_TYPE(tag->type)); @@ -3265,7 +3265,7 @@ static bool zend_ffi_subst_old_type(zend_ffi_type **dcl, zend_ffi_type *old, zen if (ZEND_FFI_TYPE(*dcl) == type) { *dcl = old; - return 1; + return true; } dcl_type = *dcl; switch (dcl_type->kind) { @@ -3275,14 +3275,14 @@ static bool zend_ffi_subst_old_type(zend_ffi_type **dcl, zend_ffi_type *old, zen return zend_ffi_subst_old_type(&dcl_type->array.type, old, type); case ZEND_FFI_TYPE_FUNC: if (zend_ffi_subst_old_type(&dcl_type->func.ret_type, old, type)) { - return 1; + return true; } if (dcl_type->func.args) { zval *zv; ZEND_HASH_PACKED_FOREACH_VAL(dcl_type->func.args, zv) { if (zend_ffi_subst_old_type((zend_ffi_type**)&Z_PTR_P(zv), old, type)) { - return 1; + return true; } } ZEND_HASH_FOREACH_END(); } @@ -3290,14 +3290,14 @@ static bool zend_ffi_subst_old_type(zend_ffi_type **dcl, zend_ffi_type *old, zen case ZEND_FFI_TYPE_STRUCT: ZEND_HASH_MAP_FOREACH_PTR(&dcl_type->record.fields, field) { if (zend_ffi_subst_old_type(&field->type, old, type)) { - return 1; + return true; } } ZEND_HASH_FOREACH_END(); break; default: break; } - return 0; + return false; } /* }}} */ static void zend_ffi_cleanup_type(zend_ffi_type *old, zend_ffi_type *type) /* {{{ */ @@ -3788,7 +3788,7 @@ static bool zend_ffi_subst_type(zend_ffi_type **dcl, zend_ffi_type *type) /* {{{ if (*dcl == type) { *dcl = ZEND_FFI_TYPE_MAKE_OWNED(type); - return 1; + return true; } dcl_type = *dcl; switch (dcl_type->kind) { @@ -3798,14 +3798,14 @@ static bool zend_ffi_subst_type(zend_ffi_type **dcl, zend_ffi_type *type) /* {{{ return zend_ffi_subst_type(&dcl_type->array.type, type); case ZEND_FFI_TYPE_FUNC: if (zend_ffi_subst_type(&dcl_type->func.ret_type, type)) { - return 1; + return true; } if (dcl_type->func.args) { zval *zv; ZEND_HASH_PACKED_FOREACH_VAL(dcl_type->func.args, zv) { if (zend_ffi_subst_type((zend_ffi_type**)&Z_PTR_P(zv), type)) { - return 1; + return true; } } ZEND_HASH_FOREACH_END(); } @@ -3813,14 +3813,14 @@ static bool zend_ffi_subst_type(zend_ffi_type **dcl, zend_ffi_type *type) /* {{{ case ZEND_FFI_TYPE_STRUCT: ZEND_HASH_MAP_FOREACH_PTR(&dcl_type->record.fields, field) { if (zend_ffi_subst_type(&field->type, type)) { - return 1; + return true; } } ZEND_HASH_FOREACH_END(); break; default: break; } - return 0; + return false; } /* }}} */ static void zend_ffi_tags_cleanup(zend_ffi_dcl *dcl) /* {{{ */ @@ -5908,9 +5908,9 @@ bool zend_ffi_is_typedef_name(const char *name, size_t name_len) /* {{{ */ } type = zend_hash_str_find_ptr(&FFI_G(types), name, name_len); if (type) { - return 1; + return true; } - return 0; + return false; } /* }}} */ diff --git a/ext/intl/intl_icu_compat.c b/ext/intl/intl_icu_compat.c index 5aa12851cfb5..02b1f23d6bdd 100644 --- a/ext/intl/intl_icu_compat.c +++ b/ext/intl/intl_icu_compat.c @@ -89,7 +89,7 @@ UBool intl_icu_compat_uspoof_check_result_mismatch(IntlIcuSpoofCheckResult *chec (void) check_result; (void) status; *result_checks = checks; - return 0; + return false; #endif } diff --git a/ext/intl/uchar/uchar.cpp b/ext/intl/uchar/uchar.cpp index 4b881a4b1c00..ad2ff9502c00 100644 --- a/ext/intl/uchar/uchar.cpp +++ b/ext/intl/uchar/uchar.cpp @@ -306,7 +306,7 @@ static UBool enumCharNames_callback(enumCharNames_data *context, intl_error_set_custom_msg(NULL, "enumCharNames callback failed"); zval_ptr_dtor(&retval); zval_ptr_dtor_str(&args[2]); - return 0; + return false; } zval_ptr_dtor(&retval); zval_ptr_dtor_str(&args[2]); diff --git a/ext/opcache/jit/zend_jit.c b/ext/opcache/jit/zend_jit.c index 885ddffd731f..a68a49072b7f 100644 --- a/ext/opcache/jit/zend_jit.c +++ b/ext/opcache/jit/zend_jit.c @@ -129,7 +129,7 @@ static bool zend_ssa_is_last_use(const zend_op_array *op_array, const zend_ssa * zend_ssa_phi *phi = ssa->vars[var].phi_use_chain; do { if (!ssa->vars[phi->ssa_var].no_val) { - return 0; + return false; } phi = zend_ssa_next_use_phi(ssa, var, phi); } while (phi); @@ -149,14 +149,14 @@ static bool zend_ssa_is_last_use(const zend_op_array *op_array, const zend_ssa * } if (dominates(ssa->cfg.blocks, def_block, (ssa->cfg.blocks[b].flags & ZEND_BB_LOOP_HEADER) ? b : ssa->cfg.blocks[b].loop_header)) { - return 0; + return false; } while (prev_use >= 0 && prev_use != use) { if (b != ssa->cfg.map[prev_use] && dominates(ssa->cfg.blocks, b, ssa->cfg.map[prev_use]) && !zend_ssa_is_no_val_use(op_array->opcodes + prev_use, ssa->ops + prev_use, var)) { - return 0; + return false; } prev_use = zend_ssa_next_use(ssa->ops, var, prev_use); } @@ -164,11 +164,11 @@ static bool zend_ssa_is_last_use(const zend_op_array *op_array, const zend_ssa * next_use = zend_ssa_next_use(ssa->ops, var, use); if (next_use < 0) { - return 1; + return true; } else if (zend_ssa_is_no_val_use(op_array->opcodes + next_use, ssa->ops + next_use, var)) { - return 1; + return true; } - return 0; + return false; } static int zend_jit_is_constant_cmp_long_long(const zend_op *opline, @@ -516,7 +516,7 @@ static bool zend_jit_may_avoid_refcounting(const zend_op *opline, uint32_t op1_i if (!JIT_G(current_frame) || !JIT_G(current_frame)->call->func || !TRACE_FRAME_IS_LAST_SEND_BY_VAL(JIT_G(current_frame)->call)) { - return 0; + return false; } /* break missing intentionally */ case ZEND_FETCH_OBJ_R: @@ -525,26 +525,26 @@ static bool zend_jit_may_avoid_refcounting(const zend_op *opline, uint32_t op1_i && opline->op2_type == IS_CONST && Z_TYPE_P(RT_CONSTANT(opline, opline->op2)) == IS_STRING && Z_STRVAL_P(RT_CONSTANT(opline, opline->op2))[0] != '\0') { - return 1; + return true; } break; case ZEND_FETCH_DIM_FUNC_ARG: if (!JIT_G(current_frame) || !JIT_G(current_frame)->call->func || !TRACE_FRAME_IS_LAST_SEND_BY_VAL(JIT_G(current_frame)->call)) { - return 0; + return false; } /* break missing intentionally */ case ZEND_FETCH_DIM_R: case ZEND_FETCH_DIM_IS: - return 1; + return true; case ZEND_ISSET_ISEMPTY_DIM_OBJ: if (!(opline->extended_value & ZEND_ISEMPTY)) { - return 1; + return true; } break; } - return 0; + return false; } static bool zend_jit_is_persistent_constant(zval *key, uint32_t flags) @@ -683,13 +683,13 @@ static bool zend_may_be_dynamic_property(zend_class_entry *ce, zend_string *memb zend_property_info *info; if (!ce || (ce->ce_flags & ZEND_ACC_TRAIT) || (op_array->fn_flags & ZEND_ACC_TRAIT_CLONE)) { - return 1; + return true; } if (!(ce->ce_flags & ZEND_ACC_IMMUTABLE)) { if (ce->info.user.filename != op_array->filename) { /* class declaration might be changed independently */ - return 1; + return true; } } @@ -699,15 +699,15 @@ static bool zend_may_be_dynamic_property(zend_class_entry *ce, zend_string *memb !IS_VALID_PROPERTY_OFFSET(info->offset) || (info->flags & ZEND_ACC_STATIC) || info->hooks) { - return 1; + return true; } if (!(info->flags & ZEND_ACC_PUBLIC) && (!on_this || info->ce != ce)) { - return 1; + return true; } - return 0; + return false; } static bool zend_jit_class_may_be_modified(const zend_class_entry *ce, const zend_op_array *called_from) @@ -717,47 +717,47 @@ static bool zend_jit_class_may_be_modified(const zend_class_entry *ce, const zen if (ce->type == ZEND_INTERNAL_CLASS) { #ifdef ZEND_OPCACHE_SHM_REATTACHMENT /* ASLR */ - return 1; + return true; #else - return 0; + return false; #endif } else if (ce->type == ZEND_USER_CLASS) { if (ce->ce_flags & ZEND_ACC_PRELOADED) { - return 0; + return false; } if (ce->info.user.filename == called_from->filename) { if (ce->parent && (!(ce->ce_flags & ZEND_ACC_LINKED) || zend_jit_class_may_be_modified(ce->parent, called_from))) { - return 1; + return true; } if (ce->num_interfaces) { if (!(ce->ce_flags & ZEND_ACC_LINKED)) { - return 1; + return true; } for (i = 0; i < ce->num_interfaces; i++) { if (zend_jit_class_may_be_modified(ce->interfaces[i], called_from)) { - return 1; + return true; } } } if (ce->num_traits) { if (!(ce->ce_flags & ZEND_ACC_LINKED)) { - return 1; + return true; } for (i=0; i < ce->num_traits; i++) { zend_class_entry *trait = zend_fetch_class_by_name(ce->trait_names[i].name, ce->trait_names[i].lc_name, ZEND_FETCH_CLASS_TRAIT | ZEND_FETCH_CLASS_NO_AUTOLOAD | ZEND_FETCH_CLASS_SILENT); if (!trait || zend_jit_class_may_be_modified(trait, called_from)) { - return 1; + return true; } } } - return 0; + return false; } } - return 1; + return true; } static bool zend_jit_may_be_modified(const zend_function *func, const zend_op_array *called_from) @@ -765,21 +765,21 @@ static bool zend_jit_may_be_modified(const zend_function *func, const zend_op_ar if (func->type == ZEND_INTERNAL_FUNCTION) { #ifdef ZEND_OPCACHE_SHM_REATTACHMENT /* ASLR */ - return 1; + return true; #else - return 0; + return false; #endif } else if (func->type == ZEND_USER_FUNCTION) { if (func->common.fn_flags & ZEND_ACC_PRELOADED) { - return 0; + return false; } if (func->op_array.filename == called_from->filename && (!func->op_array.scope || !zend_jit_class_may_be_modified(func->op_array.scope, called_from))) { - return 0; + return false; } } - return 1; + return true; } #define OP_RANGE(ssa_op, opN) \ @@ -1395,9 +1395,9 @@ static bool zend_jit_next_is_send_result(const zend_op *opline) && (opline+1)->op1_type == IS_TMP_VAR && (opline+1)->op2_type != IS_CONST && (opline+1)->op1.var == opline->result.var) { - return 1; + return true; } - return 0; + return false; } static bool zend_jit_supported_binary_op(uint8_t op, uint32_t op1_info, uint32_t op2_info) diff --git a/ext/opcache/jit/zend_jit_helpers.c b/ext/opcache/jit/zend_jit_helpers.c index d9b91d299f59..a610f580389d 100644 --- a/ext/opcache/jit/zend_jit_helpers.c +++ b/ext/opcache/jit/zend_jit_helpers.c @@ -2217,7 +2217,7 @@ static zend_always_inline bool promotes_to_array(zval *val) { static zend_always_inline bool check_type_array_assignable(zend_type type) { if (!ZEND_TYPE_IS_SET(type)) { - return 1; + return true; } return (ZEND_TYPE_FULL_MASK(type) & MAY_BE_ARRAY) != 0; } @@ -2253,7 +2253,7 @@ static zend_never_inline bool zend_handle_fetch_obj_flags( if (!check_type_array_assignable(prop_info->type)) { zend_throw_auto_init_in_prop_error(prop_info, "array"); if (result) ZVAL_ERROR(result); - return 0; + return false; } } break; @@ -2266,7 +2266,7 @@ static zend_never_inline bool zend_handle_fetch_obj_flags( if (!ZEND_TYPE_ALLOW_NULL(prop_info->type)) { zend_throw_access_uninit_prop_by_ref_error(prop_info); if (result) ZVAL_ERROR(result); - return 0; + return false; } ZVAL_NULL(ptr); } @@ -2278,7 +2278,7 @@ static zend_never_inline bool zend_handle_fetch_obj_flags( break; default: ZEND_UNREACHABLE(); } - return 1; + return true; } static void ZEND_FASTCALL zend_jit_fetch_obj_w_slow(zend_object *zobj) diff --git a/ext/opcache/jit/zend_jit_internal.h b/ext/opcache/jit/zend_jit_internal.h index 5fb620054beb..e802e9ecacc6 100644 --- a/ext/opcache/jit/zend_jit_internal.h +++ b/ext/opcache/jit/zend_jit_internal.h @@ -715,10 +715,10 @@ static zend_always_inline bool zend_jit_may_be_polymorphic_call(const zend_op *o || opline->opcode == ZEND_INIT_FCALL_BY_NAME || opline->opcode == ZEND_INIT_NS_FCALL_BY_NAME || opline->opcode == ZEND_INIT_PARENT_PROPERTY_HOOK_CALL) { - return 0; + return false; } else if (opline->opcode == ZEND_INIT_METHOD_CALL || opline->opcode == ZEND_INIT_DYNAMIC_CALL) { - return 1; + return true; } else if (opline->opcode == ZEND_INIT_STATIC_METHOD_CALL) { return (opline->op1_type != IS_CONST || opline->op2_type != IS_CONST); } else if (opline->opcode == ZEND_INIT_USER_CALL) { @@ -727,7 +727,7 @@ static zend_always_inline bool zend_jit_may_be_polymorphic_call(const zend_op *o return (opline->op1_type != IS_CONST); } else { ZEND_UNREACHABLE(); - return 0; + return false; } } diff --git a/ext/opcache/jit/zend_jit_ir.c b/ext/opcache/jit/zend_jit_ir.c index fbee0dbb40b1..65713fd362f2 100644 --- a/ext/opcache/jit/zend_jit_ir.c +++ b/ext/opcache/jit/zend_jit_ir.c @@ -1306,7 +1306,7 @@ static bool zend_jit_spilling_may_cause_conflict(zend_jit_ctx *jit, int var, ir_ // && jit->ctx.ir_base[jit->ctx.ir_base[jit->ctx.ir_base[val].op2].op2].val.addr == (uintptr_t)EX_NUM_TO_VAR(jit->ssa->vars[var].var)) { // /* LOAD from the same location (the LOAD is pinned) */ // // TODO: should be anti-dependent with the following stores ??? -// return 0; +// return false; // } if (jit->ssa->vars[var].var < jit->current_op_array->last_var) { /* IS_CV */ diff --git a/ext/opcache/jit/zend_jit_trace.c b/ext/opcache/jit/zend_jit_trace.c index 6aafc307057d..22ad4283eb1d 100644 --- a/ext/opcache/jit/zend_jit_trace.c +++ b/ext/opcache/jit/zend_jit_trace.c @@ -3546,10 +3546,10 @@ static bool zend_jit_trace_stack_has_unstored_refs(zend_jit_trace_stack *stack, for (i = 0; i < stack_size; i++) { if (STACK_REF(stack, i) && !(STACK_FLAGS(stack, i) & (ZREG_LOAD|ZREG_STORE))) { - return 1; + return true; } } - return 0; + return false; } static int zend_jit_trace_exit_needs_deoptimization(uint32_t trace_num, uint32_t exit_num) diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c index b8fd17fdba28..8729a3cedf84 100644 --- a/ext/standard/basic_functions.c +++ b/ext/standard/basic_functions.c @@ -1723,7 +1723,7 @@ PHPAPI bool register_user_shutdown_function(const char *function_name, size_t fu } zend_hash_str_update_mem(BG(user_shutdown_function_names), function_name, function_len, shutdown_function_entry, sizeof(php_shutdown_function_entry)); - return 1; + return true; } /* }}} */ @@ -1733,7 +1733,7 @@ PHPAPI bool remove_user_shutdown_function(const char *function_name, size_t func return zend_hash_str_del(BG(user_shutdown_function_names), function_name, function_len) != FAILURE; } - return 0; + return false; } /* }}} */ diff --git a/main/php_variables.c b/main/php_variables.c index 398f6e484d28..c8c27da502db 100644 --- a/main/php_variables.c +++ b/main/php_variables.c @@ -382,7 +382,7 @@ static bool add_post_var(zval *arr, post_var_data_t *var, bool eof) val = estrndup(ksep, vlen); if (ZEND_HAS_OOM()) { efree(val); - return 0; + return false; } if (vlen) { vlen = php_url_decode(val, vlen); @@ -393,7 +393,7 @@ static bool add_post_var(zval *arr, post_var_data_t *var, bool eof) } if (ZEND_HAS_OOM()) { efree(val); - return 0; + return false; } efree(val); diff --git a/main/streams/streams.c b/main/streams/streams.c index fb311a8e2d05..a2cc0214ad5d 100644 --- a/main/streams/streams.c +++ b/main/streams/streams.c @@ -754,7 +754,7 @@ PHPAPI bool php_stream_eof(php_stream *stream) { /* if there is data in the buffer, it's not EOF */ if (stream->writepos - stream->readpos > 0) { - return 0; + return false; } /* use the configured timeout when checking eof */ @@ -794,9 +794,9 @@ PHPAPI bool php_stream_puts(php_stream *stream, const char *buf) len = strlen(buf); if (len > 0 && php_stream_write(stream, buf, len) > 0 && php_stream_write(stream, newline, 1) > 0) { - return 1; + return true; } - return 0; + return false; } PHPAPI int php_stream_stat(php_stream *stream, php_stream_statbuf *ssb) diff --git a/sapi/phpdbg/phpdbg_bp.c b/sapi/phpdbg/phpdbg_bp.c index 1233f0430121..0debaaaf1413 100644 --- a/sapi/phpdbg/phpdbg_bp.c +++ b/sapi/phpdbg/phpdbg_bp.c @@ -1016,7 +1016,7 @@ static inline bool phpdbg_find_breakpoint_param(phpdbg_param_t *param, zend_exec /* function breakpoint */ if (function->type != ZEND_USER_FUNCTION) { - return 0; + return false; } { @@ -1047,7 +1047,7 @@ static inline bool phpdbg_find_breakpoint_param(phpdbg_param_t *param, zend_exec case NUMERIC_METHOD_PARAM: case METHOD_PARAM: { if (function->type != ZEND_USER_FUNCTION) { - return 0; + return false; } { @@ -1075,7 +1075,7 @@ static inline bool phpdbg_find_breakpoint_param(phpdbg_param_t *param, zend_exec /* do nothing */ } break; } - return 0; + return false; } /* }}} */ static inline phpdbg_breakbase_t *phpdbg_find_conditional_breakpoint(zend_execute_data *execute_data) /* {{{ */ diff --git a/sapi/phpdbg/phpdbg_cmd.c b/sapi/phpdbg/phpdbg_cmd.c index 49f866f963d5..0ac7ac4afb6f 100644 --- a/sapi/phpdbg/phpdbg_cmd.c +++ b/sapi/phpdbg/phpdbg_cmd.c @@ -253,7 +253,7 @@ PHPDBG_API bool phpdbg_match_param(const phpdbg_param_t *l, const phpdbg_param_t switch (l->type) { case STACK_PARAM: /* nope, or yep */ - return 1; + return true; break; case NUMERIC_FUNCTION_PARAM: @@ -309,7 +309,7 @@ PHPDBG_API bool phpdbg_match_param(const phpdbg_param_t *l, const phpdbg_param_t } break; case EMPTY_PARAM: - return 1; + return true; default: { /* not yet */ @@ -317,7 +317,7 @@ PHPDBG_API bool phpdbg_match_param(const phpdbg_param_t *l, const phpdbg_param_t } } } - return 0; + return false; } /* }}} */ /* {{{ */ diff --git a/sapi/phpdbg/phpdbg_utils.c b/sapi/phpdbg/phpdbg_utils.c index c259a0d1aced..77f4c669c399 100644 --- a/sapi/phpdbg/phpdbg_utils.c +++ b/sapi/phpdbg/phpdbg_utils.c @@ -616,7 +616,7 @@ PHPDBG_API bool phpdbg_check_caught_ex(zend_execute_data *execute_data, zend_obj uint32_t catch = op_array->try_catch_array[i].catch_op, finally = op_array->try_catch_array[i].finally_op; if (op_num <= catch || op_num <= finally) { if (finally) { - return 1; + return true; } cur = &op_array->opcodes[catch]; @@ -629,17 +629,17 @@ PHPDBG_API bool phpdbg_check_caught_ex(zend_execute_data *execute_data, zend_obj } if (ce == exception->ce || (ce && instanceof_function(exception->ce, ce))) { - return 1; + return true; } if (cur->extended_value & ZEND_LAST_CATCH) { - return 0; + return false; } cur = OP_JMP_ADDR(cur, cur->op2); } - return 0; + return false; } } diff --git a/win32/ioutil.c b/win32/ioutil.c index 8ac4d39d67cf..7b158caf07cd 100644 --- a/win32/ioutil.c +++ b/win32/ioutil.c @@ -340,11 +340,11 @@ PW32IO BOOL php_win32_ioutil_posix_to_open_opts(int flags, mode_t mode, php_iout /* XXX not being done as this means a behavior change. Should be evaluated properly. */ /* opts->attributes |= FILE_FLAG_BACKUP_SEMANTICS; */ - return 1; + return true; einval: _set_errno(EINVAL); - return 0; + return false; }/*}}}*/ PW32IO int php_win32_ioutil_open_w(const wchar_t *path, int flags, ...)