1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00

spl: Use true / false instead of 1 / 0 when assigning to bool

Changes done with Coccinelle:

    @@
    bool b;
    @@

    - b = 0
    + b = false

    @@
    bool b;
    @@

    - b = 1
    + b = true
This commit is contained in:
Tim Düsterhus
2025-09-23 22:52:40 +02:00
committed by Tim Düsterhus
parent 59f2228667
commit 15baf35cf0
6 changed files with 13 additions and 13 deletions

View File

@@ -66,7 +66,7 @@ PHP_FUNCTION(class_parents)
{
zval *obj;
zend_class_entry *parent_class, *ce;
bool autoload = 1;
bool autoload = true;
/* We do not use Z_PARAM_OBJ_OR_STR here to be able to exclude int, float, and bool which are bogus class names */
if (zend_parse_parameters(ZEND_NUM_ARGS(), "z|b", &obj, &autoload) == FAILURE) {
@@ -99,7 +99,7 @@ PHP_FUNCTION(class_parents)
PHP_FUNCTION(class_implements)
{
zval *obj;
bool autoload = 1;
bool autoload = true;
zend_class_entry *ce;
/* We do not use Z_PARAM_OBJ_OR_STR here to be able to exclude int, float, and bool which are bogus class names */
@@ -128,7 +128,7 @@ PHP_FUNCTION(class_implements)
PHP_FUNCTION(class_uses)
{
zval *obj;
bool autoload = 1;
bool autoload = true;
zend_class_entry *ce;
/* We do not use Z_PARAM_OBJ_OR_STR here to be able to exclude int, float, and bool which are bogus class names */

View File

@@ -777,11 +777,11 @@ static HashTable *spl_array_get_properties_for(zend_object *object, zend_prop_pu
* meantime. */
switch (purpose) {
case ZEND_PROP_PURPOSE_ARRAY_CAST:
dup = 1;
dup = true;
break;
case ZEND_PROP_PURPOSE_VAR_EXPORT:
case ZEND_PROP_PURPOSE_JSON:
dup = 0;
dup = false;
break;
default:
return zend_std_get_properties_for(object, purpose);

View File

@@ -493,7 +493,7 @@ static spl_filesystem_object *spl_filesystem_object_create_info(zend_string *fil
static spl_filesystem_object *spl_filesystem_object_create_type(int num_args, spl_filesystem_object *source, int type, zend_class_entry *ce, zval *return_value) /* {{{ */
{
spl_filesystem_object *intern;
bool use_include_path = 0;
bool use_include_path = false;
zval arg1, arg2;
zend_error_handling error_handling;
@@ -2014,7 +2014,7 @@ PHP_METHOD(SplFileObject, __construct)
zend_string *file_name = NULL;
zend_string *open_mode = ZSTR_CHAR('r');
zval *stream_context = NULL;
bool use_include_path = 0;
bool use_include_path = false;
size_t path_len;
zend_error_handling error_handling;

View File

@@ -702,7 +702,7 @@ PHP_METHOD(SplDoublyLinkedList, offsetGet)
PHP_METHOD(SplDoublyLinkedList, offsetSet)
{
zend_long index;
bool index_is_null = 1;
bool index_is_null = true;
zval *value;
spl_dllist_object *intern;

View File

@@ -706,7 +706,7 @@ PHP_METHOD(SplFixedArray, fromArray)
spl_fixedarray array;
spl_fixedarray_object *intern;
int num;
bool save_indexes = 1;
bool save_indexes = true;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "a|b", &data, &save_indexes) == FAILURE) {
RETURN_THROWS();

View File

@@ -222,7 +222,7 @@ static zend_result spl_recursive_it_valid_ex(spl_recursive_it_object *object, zv
if (object->endIteration && object->in_iteration) {
zend_call_method_with_0_params(Z_OBJ_P(zthis), object->ce, &object->endIteration, "endIteration", NULL);
}
object->in_iteration = 0;
object->in_iteration = false;
return FAILURE;
}
@@ -460,7 +460,7 @@ static void spl_recursive_it_rewind_ex(spl_recursive_it_object *object, zval *zt
if (!EG(exception) && object->beginIteration && !object->in_iteration) {
zend_call_method_with_0_params(Z_OBJ_P(zthis), object->ce, &object->beginIteration, "beginIteration", NULL);
}
object->in_iteration = 1;
object->in_iteration = true;
spl_recursive_it_move_forward_ex(object, zthis);
}
@@ -614,7 +614,7 @@ static void spl_recursive_it_it_construct(INTERNAL_FUNCTION_PARAMETERS, zend_cla
intern->mode = mode;
intern->flags = (int)flags;
intern->max_depth = -1;
intern->in_iteration = 0;
intern->in_iteration = false;
intern->ce = Z_OBJCE_P(object);
intern->beginIteration = zend_hash_str_find_ptr(&intern->ce->function_table, "beginiteration", sizeof("beginiteration") - 1);
@@ -740,7 +740,7 @@ PHP_METHOD(RecursiveIteratorIterator, getSubIterator)
{
spl_recursive_it_object *object = Z_SPLRECURSIVE_IT_P(ZEND_THIS);
zend_long level;
bool level_is_null = 1;
bool level_is_null = true;
zval *value;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|l!", &level, &level_is_null) == FAILURE) {