Float precision loss error

Created on 12 February 2024, 8 months ago
Updated 19 April 2024, 5 months ago

Problem/Motivation

This is a minor one, but we saw it in some cases in the funnelbackTruncateUrl function.

Deprecated function: Implicit conversion from float 31.5 to int loses precision in Drupal\funnelback\Funnelback->funnelbackTruncateUrl() (line 385 of modules/contrib/funnelback/src/Funnelback.php).

Drupal\funnelback\Funnelback->funnelbackTruncateUrl('<url goes here>') (Line: 270)
...

I reckon this is due to the ellipsis placement function not correctly rounding $start in some cases. https://git.drupalcode.org/project/funnelback/-/blob/8.x-1.x/src/Funnelb...

Steps to reproduce

(Probably hard to reproduce this one? Would depend on the length of the URL host and maximum length of titles.)

Proposed resolution

Round down to the next integer.

Remaining tasks

All work above. Maybe some tests.

User interface changes

None.

API changes

None.

Data model changes

None.

🐛 Bug report
Status

Fixed

Version

2.0

Component

Code

Created by

🇦🇺Australia geoffreyr

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

Comments & Activities

Production build 0.71.5 2024