PHP8 + MAX aggregation in Views on Date fields throw error

Created on 9 August 2022, almost 3 years ago
Updated 27 January 2023, over 2 years ago

watchdog error:
TypeError: round(): Argument #1 ($num) must be of type int|float, string given in round() (line 173 of /xxx_proj_folder/docroot/core/modules/views/src/Plugin/views/field/NumericField.php)
#0 /xxx_proj_folder/docroot/core/modules/views/src/Plugin/views/field/NumericField.php(173): round('2021-06-29', 0)

code:
$value = round($value, $precision);
value is string '2021-06-29' (just example)

if php version is 7, it will return '2021' and no error,
php 8 will throw this error.

related issue:
https://www.drupal.org/project/drupal/issues/3151654 πŸ› Date field is not displaying correct value on a views with aggregation max/min Needs work

πŸ› Bug report
Status

Needs work

Version

10.1 ✨

Component
ViewsΒ  β†’

Last updated about 11 hours ago

Created by

πŸ‡¨πŸ‡³China caohan@ciandt.com

Live updates comments and jobs are added and updated live.
  • Needs tests

    The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024