Views NumericField round must be of type int|float

Created on 3 February 2023, almost 2 years ago
Updated 23 January 2024, 11 months ago

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.

πŸ› Bug report
Status

Active

Version

9.5

Component
ViewsΒ  β†’

Last updated about 2 hours ago

Created by

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @evonasek
  • Status changed to Postponed: needs info almost 2 years ago
  • πŸ‡³πŸ‡±Netherlands Lendude Amsterdam

    @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 module, so we need to be sure that this is an actual bug and not just bad data.

  • πŸ‡©πŸ‡ͺGermany pebosi

    Same bug on my views, having aggregations activated.

    Patch works for me.

  • Status changed to Active almost 2 years ago
  • πŸ‡ΈπŸ‡ͺSweden johnzzon Gothenburg πŸ‡ΈπŸ‡ͺ

    I 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:

    • Enable the Date range module
    • Create a date range field (can be cardinality of 1 or unlimited, doesn't matter) on any content type
    • Create a node and fill the date field
    • Create a view with a page display that lists nodes of the content type
    • Add the date field, set format to
    • Turn on Aggregation
    • Set Aggregation settings on the field to "Minimum"
    • Save the view
    • Go to the view page and see that the error triggers

    Using xdebug, I can see that the $value is 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.

  • πŸ‡©πŸ‡ͺGermany pebosi

    Updated patch for 10.2

Production build 0.71.5 2024