diff --git a/Zend/zend.c b/Zend/zend.c index c07fabcb36f..30b5a8c134c 100644 --- a/Zend/zend.c +++ b/Zend/zend.c @@ -910,7 +910,7 @@ static bool php_auto_globals_create_globals(zend_string *name) /* {{{ */ { /* While we keep registering $GLOBALS as an auto-global, we do not create an * actual variable for it. Access to it handled specially by the compiler. */ - return 0; + return false; } /* }}} */ diff --git a/Zend/zend_alloc.c b/Zend/zend_alloc.c index f3dfe0f9df5..1157dc98fa6 100644 --- a/Zend/zend_alloc.c +++ b/Zend/zend_alloc.c @@ -2627,7 +2627,7 @@ ZEND_API bool is_zend_mm(void) #if ZEND_MM_CUSTOM return !AG(mm_heap)->use_custom_heap; #else - return 1; + return true; #endif } diff --git a/Zend/zend_ast.c b/Zend/zend_ast.c index 9cb3c7aae4a..72202f322e0 100644 --- a/Zend/zend_ast.c +++ b/Zend/zend_ast.c @@ -1575,9 +1575,9 @@ static ZEND_COLD bool zend_ast_valid_var_char(char ch) (c < '0' || c > '9') && (c < 'A' || c > 'Z') && (c < 'a' || c > 'z')) { - return 0; + return false; } - return 1; + return true; } static ZEND_COLD bool zend_ast_valid_var_name(const char *s, size_t len) @@ -1586,13 +1586,13 @@ static ZEND_COLD bool zend_ast_valid_var_name(const char *s, size_t len) size_t i; if (len == 0) { - return 0; + return false; } c = (unsigned char)s[0]; if (c != '_' && c < 127 && (c < 'A' || c > 'Z') && (c < 'a' || c > 'z')) { - return 0; + return false; } for (i = 1; i < len; i++) { c = (unsigned char)s[i]; @@ -1600,10 +1600,10 @@ static ZEND_COLD bool zend_ast_valid_var_name(const char *s, size_t len) (c < '0' || c > '9') && (c < 'A' || c > 'Z') && (c < 'a' || c > 'z')) { - return 0; + return false; } } - return 1; + return true; } static ZEND_COLD bool zend_ast_var_needs_braces(char ch) diff --git a/Zend/zend_closures.c b/Zend/zend_closures.c index 4a6b5a52188..4c2b85f5d48 100644 --- a/Zend/zend_closures.c +++ b/Zend/zend_closures.c @@ -82,7 +82,7 @@ static bool zend_valid_closure_binding( if (newthis) { if (func->common.fn_flags & ZEND_ACC_STATIC) { zend_error(E_WARNING, "Cannot bind an instance to a static closure, this will be an error in PHP 9"); - return 0; + return false; } if (is_fake_closure && func->common.scope && @@ -92,23 +92,23 @@ static bool zend_valid_closure_binding( ZSTR_VAL(func->common.scope->name), ZSTR_VAL(func->common.function_name), ZSTR_VAL(Z_OBJCE_P(newthis)->name)); - return 0; + return false; } } else if (is_fake_closure && func->common.scope && !(func->common.fn_flags & ZEND_ACC_STATIC)) { zend_error(E_WARNING, "Cannot unbind $this of method, this will be an error in PHP 9"); - return 0; + return false; } else if (!is_fake_closure && !Z_ISUNDEF(closure->this_ptr) && (func->common.fn_flags & ZEND_ACC_USES_THIS)) { zend_error(E_WARNING, "Cannot unbind $this of closure using $this, this will be an error in PHP 9"); - return 0; + return false; } if (scope && scope != func->common.scope && scope->type == ZEND_INTERNAL_CLASS) { /* rebinding to internal class is not allowed */ zend_error(E_WARNING, "Cannot bind closure to scope of internal class %s, this will be an error in PHP 9", ZSTR_VAL(scope->name)); - return 0; + return false; } if (is_fake_closure && scope != func->common.scope) { @@ -117,10 +117,10 @@ static bool zend_valid_closure_binding( } else { zend_error(E_WARNING, "Cannot rebind scope of closure created from method, this will be an error in PHP 9"); } - return 0; + return false; } - return 1; + return true; } /* }}} */ diff --git a/Zend/zend_cpuinfo.c b/Zend/zend_cpuinfo.c index 6264031ceba..9f8f1354be0 100644 --- a/Zend/zend_cpuinfo.c +++ b/Zend/zend_cpuinfo.c @@ -93,21 +93,21 @@ static unsigned get_xcr0_eax(void) { static bool is_avx_supported(void) { if (!(cpuinfo.ecx & ZEND_CPU_FEATURE_AVX)) { /* No support for AVX */ - return 0; + return false; } if (!(cpuinfo.ecx & ZEND_CPU_FEATURE_OSXSAVE)) { /* The operating system does not support XSAVE. */ - return 0; + return false; } if ((get_xcr0_eax() & 0x6) != 0x6) { /* XCR0 SSE and AVX bits must be set. */ - return 0; + return false; } - return 1; + return true; } #else static bool is_avx_supported(void) { - return 0; + return false; } #endif diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c index 5665cc0c3f7..8eff03056c9 100644 --- a/Zend/zend_execute.c +++ b/Zend/zend_execute.c @@ -746,36 +746,36 @@ static bool zend_verify_weak_scalar_type_hint(uint32_t type_mask, zval *arg) if (type == IS_LONG) { zend_string_release(Z_STR_P(arg)); ZVAL_LONG(arg, lval); - return 1; + return true; } if (type == IS_DOUBLE) { zend_string_release(Z_STR_P(arg)); ZVAL_DOUBLE(arg, dval); - return 1; + return true; } } else if (zend_parse_arg_long_weak(arg, &lval, 0)) { zval_ptr_dtor(arg); ZVAL_LONG(arg, lval); - return 1; + return true; } else if (UNEXPECTED(EG(exception))) { - return 0; + return false; } } if ((type_mask & MAY_BE_DOUBLE) && zend_parse_arg_double_weak(arg, &dval, 0)) { zval_ptr_dtor(arg); ZVAL_DOUBLE(arg, dval); - return 1; + return true; } if ((type_mask & MAY_BE_STRING) && zend_parse_arg_str_weak(arg, &str, 0)) { /* on success "arg" is converted to IS_STRING */ - return 1; + return true; } if ((type_mask & MAY_BE_BOOL) == MAY_BE_BOOL && zend_parse_arg_bool_weak(arg, &bval, 0)) { zval_ptr_dtor(arg); ZVAL_BOOL(arg, bval); - return 1; + return true; } - return 0; + return false; } #if ZEND_DEBUG @@ -800,18 +800,18 @@ static bool zend_verify_weak_scalar_type_hint_no_sideeffect(uint32_t type_mask, /* Pass (uint32_t)-1 as arg_num to indicate to ZPP not to emit any deprecation notice, * this is needed because the version with side effects also uses 0 (e.g. for typed properties) */ if ((type_mask & MAY_BE_LONG) && zend_parse_arg_long_weak(arg, &lval, (uint32_t)-1)) { - return 1; + return true; } if ((type_mask & MAY_BE_DOUBLE) && zend_parse_arg_double_weak(arg, &dval, (uint32_t)-1)) { - return 1; + return true; } if ((type_mask & MAY_BE_STRING) && can_convert_to_string(arg)) { - return 1; + return true; } if ((type_mask & MAY_BE_BOOL) == MAY_BE_BOOL && zend_parse_arg_bool_weak(arg, &bval, (uint32_t)-1)) { - return 1; + return true; } - return 0; + return false; } #endif diff --git a/Zend/zend_inheritance.c b/Zend/zend_inheritance.c index 62b55186d6b..aea142a1f5e 100644 --- a/Zend/zend_inheritance.c +++ b/Zend/zend_inheritance.c @@ -312,7 +312,7 @@ static zend_class_entry *lookup_class(zend_class_entry *scope, zend_string *name /* Instanceof that's safe to use on unlinked classes. */ static bool unlinked_instanceof(const zend_class_entry *ce1, const zend_class_entry *ce2) { if (ce1 == ce2) { - return 1; + return true; } if (ce1->ce_flags & ZEND_ACC_LINKED) { @@ -331,7 +331,7 @@ static bool unlinked_instanceof(const zend_class_entry *ce1, const zend_class_en /* It's not sufficient to only check the parent chain itself, as need to do a full * recursive instanceof in case the parent interfaces haven't been copied yet. */ if (parent_ce && unlinked_instanceof(parent_ce, ce2)) { - return 1; + return true; } } @@ -342,7 +342,7 @@ static bool unlinked_instanceof(const zend_class_entry *ce1, const zend_class_en * check here, as the parent interfaces might not have been fully copied yet. */ for (i = 0; i < ce1->num_interfaces; i++) { if (unlinked_instanceof(ce1->interfaces[i], ce2)) { - return 1; + return true; } } } else { @@ -352,19 +352,19 @@ static bool unlinked_instanceof(const zend_class_entry *ce1, const zend_class_en ZEND_FETCH_CLASS_ALLOW_UNLINKED | ZEND_FETCH_CLASS_NO_AUTOLOAD); /* Avoid recursing if class implements itself. */ if (ce && ce != ce1 && unlinked_instanceof(ce, ce2)) { - return 1; + return true; } } } } - return 0; + return false; } static bool zend_type_permits_self( const zend_type type, const zend_class_entry *scope, zend_class_entry *self) { if (ZEND_TYPE_FULL_MASK(type) & MAY_BE_OBJECT) { - return 1; + return true; } /* Any types that may satisfy self must have already been loaded at this point @@ -376,11 +376,11 @@ static bool zend_type_permits_self( zend_string *name = resolve_class_name(scope, ZEND_TYPE_NAME(*single_type)); const zend_class_entry *ce = lookup_class(self, name); if (ce && unlinked_instanceof(self, ce)) { - return 1; + return true; } } } ZEND_TYPE_FOREACH_END(); - return 0; + return false; } static void track_class_dependency(zend_class_entry *ce, zend_string *class_name) diff --git a/Zend/zend_multibyte.c b/Zend/zend_multibyte.c index 9459920b633..bcecd979099 100644 --- a/Zend/zend_multibyte.c +++ b/Zend/zend_multibyte.c @@ -35,7 +35,7 @@ static const char *dummy_encoding_name_getter(const zend_encoding *encoding) static bool dummy_encoding_lexer_compatibility_checker(const zend_encoding *encoding) { - return 0; + return false; } static const zend_encoding *dummy_encoding_detector(const unsigned char *string, size_t length, const zend_encoding **list, size_t list_size) diff --git a/Zend/zend_opcode.c b/Zend/zend_opcode.c index f3631104c62..20fca005321 100644 --- a/Zend/zend_opcode.c +++ b/Zend/zend_opcode.c @@ -905,14 +905,14 @@ static bool keeps_op1_alive(zend_op *opline) { || opline->opcode == ZEND_FETCH_LIST_W || opline->opcode == ZEND_COPY_TMP || opline->opcode == ZEND_EXT_STMT) { - return 1; + return true; } ZEND_ASSERT(opline->opcode != ZEND_FE_FETCH_R && opline->opcode != ZEND_FE_FETCH_RW && opline->opcode != ZEND_VERIFY_RETURN_TYPE && opline->opcode != ZEND_BIND_LEXICAL && opline->opcode != ZEND_ROPE_ADD); - return 0; + return false; } /* Live ranges must be sorted by increasing start opline */ diff --git a/Zend/zend_weakrefs.c b/Zend/zend_weakrefs.c index 0c729755ff4..3b698cc02a7 100644 --- a/Zend/zend_weakrefs.c +++ b/Zend/zend_weakrefs.c @@ -237,7 +237,7 @@ static zend_object* zend_weakref_new(zend_class_entry *ce) { static zend_always_inline bool zend_weakref_find(zend_object *referent, zval *return_value) { void *tagged_ptr = zend_hash_index_find_ptr(&EG(weakrefs), zend_object_to_weakref_key(referent)); if (!tagged_ptr) { - return 0; + return false; } void *ptr = ZEND_WEAKREF_GET_PTR(tagged_ptr); @@ -247,7 +247,7 @@ static zend_always_inline bool zend_weakref_find(zend_object *referent, zval *re found_weakref: wr = ptr; RETVAL_OBJ_COPY(&wr->std); - return 1; + return true; } if (tag == ZEND_WEAKREF_TAG_HT) { @@ -259,7 +259,7 @@ found_weakref: } ZEND_HASH_FOREACH_END(); } - return 0; + return false; } static zend_always_inline void zend_weakref_create(zend_object *referent, zval *return_value) {