Skip to content

Commit 985d681

Browse files
authored
tree-wide: Replace zval_is_true() by zend_is_true() (#20065)
* tree-wide: Replace `zval_is_true()` by `zend_is_true()` The former is a direct alias of the latter which is much more often used. * zend_operators: Remove `zval_is_true()`
1 parent 7f5c3cd commit 985d681

File tree

13 files changed

+33
-34
lines changed

13 files changed

+33
-34
lines changed

UPGRADING.INTERNALS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ PHP 8.6 INTERNALS UPGRADE NOTES
2020
. The misnamed ZVAL_IS_NULL() has been removed. Use Z_ISNULL() instead.
2121
. New zend_class_entry.ce_flags2 and zend_function.fn_flags2 fields were
2222
added, given the primary flags were running out of bits.
23+
. The zval_is_true() alias of zend_is_true() has been removed. Call
24+
zend_is_true() directly instead.
2325

2426
========================
2527
2. Build system changes

Zend/zend_compile.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12062,7 +12062,7 @@ bool zend_try_ct_eval_cast(zval *result, uint32_t type, zval *op1)
1206212062
}
1206312063
switch (type) {
1206412064
case _IS_BOOL:
12065-
ZVAL_BOOL(result, zval_is_true(op1));
12065+
ZVAL_BOOL(result, zend_is_true(op1));
1206612066
return true;
1206712067
case IS_LONG:
1206812068
if (Z_TYPE_P(op1) == IS_DOUBLE && !ZEND_DOUBLE_FITS_LONG(Z_DVAL_P((op1)))) {

Zend/zend_operators.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1593,7 +1593,7 @@ ZEND_API zend_result ZEND_FASTCALL boolean_xor_function(zval *result, zval *op1,
15931593
}
15941594
}
15951595
ZEND_TRY_BINARY_OP1_OBJECT_OPERATION(ZEND_BOOL_XOR);
1596-
op1_val = zval_is_true(op1);
1596+
op1_val = zend_is_true(op1);
15971597
}
15981598
} while (0);
15991599
do {
@@ -1613,7 +1613,7 @@ ZEND_API zend_result ZEND_FASTCALL boolean_xor_function(zval *result, zval *op1,
16131613
}
16141614
}
16151615
ZEND_TRY_BINARY_OP2_OBJECT_OPERATION(ZEND_BOOL_XOR);
1616-
op2_val = zval_is_true(op2);
1616+
op2_val = zend_is_true(op2);
16171617
}
16181618
} while (0);
16191619

@@ -1641,7 +1641,7 @@ ZEND_API zend_result ZEND_FASTCALL boolean_not_function(zval *result, zval *op1)
16411641
}
16421642
ZEND_TRY_UNARY_OBJECT_OPERATION(ZEND_BOOL_NOT);
16431643

1644-
ZVAL_BOOL(result, !zval_is_true(op1));
1644+
ZVAL_BOOL(result, !zend_is_true(op1));
16451645
}
16461646
return SUCCESS;
16471647
}
@@ -2433,13 +2433,13 @@ ZEND_API int ZEND_FASTCALL zend_compare(zval *op1, zval *op2) /* {{{ */
24332433
converted = true;
24342434
}
24352435
} else if (Z_TYPE_P(op1) < IS_TRUE) {
2436-
return zval_is_true(op2) ? -1 : 0;
2436+
return zend_is_true(op2) ? -1 : 0;
24372437
} else if (Z_TYPE_P(op1) == IS_TRUE) {
2438-
return zval_is_true(op2) ? 0 : 1;
2438+
return zend_is_true(op2) ? 0 : 1;
24392439
} else if (Z_TYPE_P(op2) < IS_TRUE) {
2440-
return zval_is_true(op1) ? 1 : 0;
2440+
return zend_is_true(op1) ? 1 : 0;
24412441
} else if (Z_TYPE_P(op2) == IS_TRUE) {
2442-
return zval_is_true(op1) ? 0 : -1;
2442+
return zend_is_true(op1) ? 0 : -1;
24432443
} else {
24442444
op1 = _zendi_convert_scalar_to_number_silent(op1, &op1_copy);
24452445
op2 = _zendi_convert_scalar_to_number_silent(op2, &op2_copy);

Zend/zend_operators.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -404,9 +404,6 @@ static zend_always_inline bool try_convert_to_string(zval *op) {
404404
ZEND_API bool ZEND_FASTCALL zend_is_true(const zval *op);
405405
ZEND_API bool ZEND_FASTCALL zend_object_is_true(const zval *op);
406406

407-
#define zval_is_true(op) \
408-
zend_is_true(op)
409-
410407
static zend_always_inline bool i_zend_is_true(const zval *op)
411408
{
412409
bool result = 0;

ext/mysqli/mysqli.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ static int mysqli_object_has_property(zend_object *object, zend_string *name, in
316316
zval rv;
317317
zval *value = mysqli_read_property(object, name, BP_VAR_IS, cache_slot, &rv);
318318
if (value != &EG(uninitialized_zval)) {
319-
has_property = zval_is_true(value);
319+
has_property = zend_is_true(value);
320320
zval_ptr_dtor(value);
321321
}
322322
break;

ext/pdo/pdo_dbh.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -805,7 +805,7 @@ PDO_API bool pdo_get_bool_param(bool *bval, const zval *value)
805805
*bval = false;
806806
return true;
807807
case IS_LONG:
808-
*bval = zval_is_true(value);
808+
*bval = zend_is_true(value);
809809
return true;
810810
case IS_STRING: /* TODO Should string be allowed? */
811811
default:

ext/pdo_odbc/odbc_stmt.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -803,7 +803,7 @@ static int odbc_stmt_set_param(pdo_stmt_t *stmt, zend_long attr, zval *val)
803803
return 0;
804804

805805
case PDO_ODBC_ATTR_ASSUME_UTF8:
806-
S->assume_utf8 = zval_is_true(val);
806+
S->assume_utf8 = zend_is_true(val);
807807
return 0;
808808
default:
809809
strcpy(S->einfo.last_err_msg, "Unknown Attribute");

ext/pgsql/pgsql.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4967,7 +4967,7 @@ PHP_PGSQL_API zend_result php_pgsql_convert(PGconn *pg_link, const zend_string *
49674967
break; /* break out for() */
49684968
}
49694969

4970-
if (zval_is_true(is_enum)) {
4970+
if (zend_is_true(is_enum)) {
49714971
/* enums need to be treated like strings */
49724972
data_type = PG_TEXT;
49734973
} else {

ext/session/session.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1858,15 +1858,15 @@ PHP_FUNCTION(session_set_cookie_params)
18581858
domain = zval_get_string(value);
18591859
found++;
18601860
} else if (zend_string_equals_literal_ci(key, "secure")) {
1861-
secure = zval_is_true(value);
1861+
secure = zend_is_true(value);
18621862
secure_null = 0;
18631863
found++;
18641864
} else if (zend_string_equals_literal_ci(key, "partitioned")) {
1865-
partitioned = zval_is_true(value);
1865+
partitioned = zend_is_true(value);
18661866
partitioned_null = 0;
18671867
found++;
18681868
} else if (zend_string_equals_literal_ci(key, "httponly")) {
1869-
httponly = zval_is_true(value);
1869+
httponly = zend_is_true(value);
18701870
httponly_null = 0;
18711871
found++;
18721872
} else if (zend_string_equals_literal_ci(key, "samesite")) {

ext/sockets/multicast.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ int php_do_setsockopt_ip_mcast(php_socket *php_sock,
293293
goto dosockopt;
294294

295295
case IP_MULTICAST_LOOP:
296-
ipv4_mcast_ttl_lback = (unsigned char) zval_is_true(arg4);
296+
ipv4_mcast_ttl_lback = (unsigned char) zend_is_true(arg4);
297297
goto ipv4_loop_ttl;
298298

299299
case IP_MULTICAST_TTL:
@@ -357,7 +357,7 @@ int php_do_setsockopt_ipv6_mcast(php_socket *php_sock,
357357
goto dosockopt;
358358

359359
case IPV6_MULTICAST_LOOP:
360-
ov = (int) zval_is_true(arg4);
360+
ov = (int) zend_is_true(arg4);
361361
goto ipv6_loop_hops;
362362
case IPV6_MULTICAST_HOPS:
363363
convert_to_long(arg4);

0 commit comments

Comments
 (0)