Skip to content

Commit b843e03

Browse files
nyrzhuniluuu1994
authored andcommitted
Zend: Remove unused parameter from zend_dval_to_lval_cap()
The `zend_string *s` parameter became unused after commit f754ffa (phpGH-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 phpGH-21112
1 parent a15ba76 commit b843e03

File tree

5 files changed

+9
-11
lines changed

5 files changed

+9
-11
lines changed

UPGRADING.INTERNALS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@ PHP 8.6 INTERNALS UPGRADE NOTES
6868
more correctly represents the generic nature of the returned pointer and
6969
allows to remove explicit casts, but possibly breaks pointer arithmetic
7070
performed on the result.
71+
. The zend_dval_to_lval_cap() function no longer takes a second
72+
zend_string* parameter.
7173

7274
========================
7375
2. Build system changes

Zend/zend_operators.c

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -427,18 +427,14 @@ static zend_never_inline zend_long ZEND_FASTCALL zendi_try_get_long(const zval *
427427
* We use use saturating conversion to emulate strtol()'s
428428
* behaviour.
429429
*/
430-
if (op_str == NULL) {
431-
/* zend_dval_to_lval_cap() can emit a warning so always do the copy here */
432-
op_str = zend_string_copy(Z_STR_P(op));
433-
}
434-
lval = zend_dval_to_lval_cap(dval, op_str);
430+
lval = zend_dval_to_lval_cap(dval);
435431
if (!zend_is_long_compatible(dval, lval)) {
436-
zend_incompatible_string_to_long_error(op_str);
432+
zend_incompatible_string_to_long_error(op_str ? op_str : Z_STR_P(op));
437433
if (UNEXPECTED(EG(exception))) {
438434
*failed = true;
439435
}
440436
}
441-
zend_string_release(op_str);
437+
zend_tmp_string_release(op_str);
442438
return lval;
443439
}
444440
}
@@ -994,7 +990,7 @@ ZEND_API zend_long ZEND_FASTCALL zval_get_long_func(const zval *op, bool is_stri
994990
* behaviour.
995991
*/
996992
/* Most usages are expected to not be (int) casts */
997-
lval = zend_dval_to_lval_cap(dval, Z_STR_P(op));
993+
lval = zend_dval_to_lval_cap(dval);
998994
if (UNEXPECTED(is_strict)) {
999995
if (!zend_is_long_compatible(dval, lval)) {
1000996
zend_incompatible_string_to_long_error(Z_STR_P(op));

Zend/zend_operators.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ static zend_always_inline zend_long zend_dval_to_lval_silent(double d)
146146
}
147147

148148
/* Used to convert a string float to integer during an (int) cast */
149-
static zend_always_inline zend_long zend_dval_to_lval_cap(double d, const zend_string *s)
149+
static zend_always_inline zend_long zend_dval_to_lval_cap(double d)
150150
{
151151
if (UNEXPECTED(!zend_finite(d))) {
152152
return 0;

ext/dom/php_dom.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2267,7 +2267,7 @@ static bool dom_nodemap_or_nodelist_process_offset_as_named(zval *offset, zend_l
22672267
if (0 == (is_numeric_string_type = is_numeric_string(Z_STRVAL_P(offset), Z_STRLEN_P(offset), lval, &dval, true))) {
22682268
return true;
22692269
} else if (is_numeric_string_type == IS_DOUBLE) {
2270-
*lval = zend_dval_to_lval_cap(dval, Z_STR_P(offset));
2270+
*lval = zend_dval_to_lval_cap(dval);
22712271
}
22722272
} else {
22732273
*lval = zval_get_long(offset);

ext/tidy/tidy.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -757,7 +757,7 @@ static bool php_tidy_set_tidy_opt(TidyDoc doc, const char *optname, zval *value,
757757
}
758758
uint8_t type = is_numeric_string(ZSTR_VAL(str), ZSTR_LEN(str), &lval, &dval, true);
759759
if (type == IS_DOUBLE) {
760-
lval = zend_dval_to_lval_cap(dval, str);
760+
lval = zend_dval_to_lval_cap(dval);
761761
type = IS_LONG;
762762
}
763763
if (type == IS_LONG) {

0 commit comments

Comments
 (0)