Problem/Motivation
This error occurred in the twig render view block NumericField round must be of type int|float - PHP 8.1.x
Steps to reproduce
render block view by twig with the numeric field in it - using PHP8.1.x
Proposed resolution
We create a patch for this issue, to specify the type.
| Comment | File | Size | Author |
|---|---|---|---|
| #6 | numeric-3338895.patch | 660 bytes | pebosi |
| #2 | 3338895-view_numeric_field_round_fix.patch | 585 bytes | evonasek |
Issue fork drupal-3338895
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
evonasek commentedComment #3
lendude@evonasek thanks for reporting your issue.
We only set issues to 'fixed' once they have been committed, so moved this back.
Can you provide example code or steps of how to trigger this with just Drupal core? Often when these issues occur it is due to bad data being supplied by custom code or contrib modules, so we need to be sure that this is an actual bug and not just bad data.
Comment #4
pebosi commentedSame bug on my views, having aggregations activated.
Patch works for me.
Comment #5
johnzzonI encountered this in a project after upgrading to PHP 8.1 as well.
I tested it in the standard profile installation (no contrib or custom modules).
Steps to reproduce:
Using xdebug, I can see that the
$valueis a formatted date (eg. 2023-03-09), and I guess it uses NumericField because we use Minimum?Maybe this is not supported, but I would expect the earliest date to be used when using Minimum.
Comment #6
pebosi commentedUpdated patch for 10.2
Comment #9
mortona2k commentedThe description and patch in this issue is the same as #3302573.
Comment #10
mortona2k commentedSorry, these are actually a little different, but overlapping. This one addresses invalid numeric field values, the related issue is about date strings, which can cause this error because they're an invalid number. There is a patch in there that has this code, however there is also one that tries to fix the dates as well.