TypeError: round()

Created on 19 November 2023, about 1 year ago

Problem/Motivation

On a system running PHP 8 - when a rule triggers - containing an action Convert Data Type - set to convert text to a number, I see an error:

TypeError: round(): Argument #1 ($num) must be of type int|float, string given in round() (line 216 of /sites/all/modules/rules/modules/data.eval.inc).

Steps to reproduce

  • use Drupal with php 8.x
  • create a rule containing action Convert Data Type, set to convert text to a number

Proposed resolution

Explicitly cast the text values to be converted to numeric before rounding

πŸ› Bug report
Status

Needs review

Version

2.14

Component

Rules Core

Created by

πŸ‡ΈπŸ‡°Slovakia sano

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

Merge Requests

Comments & Activities

Production build 0.71.5 2024