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

Zend: Remove unused parameter from zend_dval_to_lval_cap()

The `zend_string *s` parameter became unused after commit f754ffa8b2
(GH-20746) removed the `zend_oob_string_to_long_error()` calls.

This fixes an unused-parameter compiler warning and updates a stale
comment in zend_operators.c that incorrectly stated this function
can emit warnings.

Closes GH-21112
This commit is contained in:
Nurzhan Bazhirov
2026-02-04 12:34:54 +05:00
committed by Ilija Tovilo
parent a15ba7672c
commit b843e03c83
5 changed files with 9 additions and 11 deletions

View File

@@ -68,6 +68,8 @@ PHP 8.6 INTERNALS UPGRADE NOTES
more correctly represents the generic nature of the returned pointer and
allows to remove explicit casts, but possibly breaks pointer arithmetic
performed on the result.
. The zend_dval_to_lval_cap() function no longer takes a second
zend_string* parameter.
========================
2. Build system changes

View File

@@ -427,18 +427,14 @@ try_again:
* We use use saturating conversion to emulate strtol()'s
* behaviour.
*/
if (op_str == NULL) {
/* zend_dval_to_lval_cap() can emit a warning so always do the copy here */
op_str = zend_string_copy(Z_STR_P(op));
}
lval = zend_dval_to_lval_cap(dval, op_str);
lval = zend_dval_to_lval_cap(dval);
if (!zend_is_long_compatible(dval, lval)) {
zend_incompatible_string_to_long_error(op_str);
zend_incompatible_string_to_long_error(op_str ? op_str : Z_STR_P(op));
if (UNEXPECTED(EG(exception))) {
*failed = true;
}
}
zend_string_release(op_str);
zend_tmp_string_release(op_str);
return lval;
}
}
@@ -994,7 +990,7 @@ try_again:
* behaviour.
*/
/* Most usages are expected to not be (int) casts */
lval = zend_dval_to_lval_cap(dval, Z_STR_P(op));
lval = zend_dval_to_lval_cap(dval);
if (UNEXPECTED(is_strict)) {
if (!zend_is_long_compatible(dval, lval)) {
zend_incompatible_string_to_long_error(Z_STR_P(op));

View File

@@ -146,7 +146,7 @@ static zend_always_inline zend_long zend_dval_to_lval_silent(double d)
}
/* Used to convert a string float to integer during an (int) cast */
static zend_always_inline zend_long zend_dval_to_lval_cap(double d, const zend_string *s)
static zend_always_inline zend_long zend_dval_to_lval_cap(double d)
{
if (UNEXPECTED(!zend_finite(d))) {
return 0;

View File

@@ -2267,7 +2267,7 @@ static bool dom_nodemap_or_nodelist_process_offset_as_named(zval *offset, zend_l
if (0 == (is_numeric_string_type = is_numeric_string(Z_STRVAL_P(offset), Z_STRLEN_P(offset), lval, &dval, true))) {
return true;
} else if (is_numeric_string_type == IS_DOUBLE) {
*lval = zend_dval_to_lval_cap(dval, Z_STR_P(offset));
*lval = zend_dval_to_lval_cap(dval);
}
} else {
*lval = zval_get_long(offset);

View File

@@ -757,7 +757,7 @@ static bool php_tidy_set_tidy_opt(TidyDoc doc, const char *optname, zval *value,
}
uint8_t type = is_numeric_string(ZSTR_VAL(str), ZSTR_LEN(str), &lval, &dval, true);
if (type == IS_DOUBLE) {
lval = zend_dval_to_lval_cap(dval, str);
lval = zend_dval_to_lval_cap(dval);
type = IS_LONG;
}
if (type == IS_LONG) {