Problem/Motivation

exception: [Deprecated function] Line 569 of modules/simpletest/tests/system_test.module:
Implicit conversion from float 7.5 to int loses precision
exception: [Deprecated function] Line 1998 of includes/common.inc:
Implicit conversion from float 2.3996500000000003 to int loses precision
exception: [Deprecated function] Line 755 of modules/color/color.module:
Implicit conversion from float 112.99284000000004 to int loses precision

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

Comments

mcdruid created an issue. See original summary.

mcdruid’s picture

Status: Active » Needs review
StatusFileSize
new835 bytes
mcdruid’s picture

StatusFileSize
new839 bytes
mcdruid’s picture

Issue summary: View changes
mcdruid’s picture

Issue summary: View changes
mcdruid’s picture

StatusFileSize
new1.88 KB
mcdruid’s picture

Looking at #3224299-19: [META] Make Drupal 7 core compatible with PHP 8.1 the change here:

-    $out |= (($v * ($normalize ? 255 : 1)) << (16 - $k * 8));
+    $out = (int) $out | (($v * ($normalize ? 255 : 1)) << (16 - $k * 8));

...has not fixed the error (/ deprecation warning).

My guess is that there's a problem with the precedence.

I'm also not certain that this is doing what it should be, although it has stopped the warnings:

-     $interval %= $value;
+     $interval = (int) $interval % $value;
mcdruid’s picture

StatusFileSize
new913 bytes
new1.88 KB

I think this is better for the color.module

mcdruid’s picture

StatusFileSize
new456 bytes
new1.88 KB

Didn't mean to include the extra parens in common.inc

mcdruid’s picture

StatusFileSize
new663 bytes
new2.5 KB

Need to ensure values passed to imagecolorallocate are int's.

mcdruid’s picture

exception: [Deprecated function] Line 209 of modules/system/image.gd.inc:
Implicit conversion from float -7.105427357601002E-15 to int loses precision
mcdruid’s picture

StatusFileSize
new639 bytes
new3.2 KB

  • mcdruid committed 248892a on 7.x
    Issue #3248752 by mcdruid: [PHP 8.1] Implicit conversion from float to...
mcdruid’s picture

Status: Needs review » Fixed
demeritcowboy’s picture

Hi,
I have added an issue and merge request https://git.drupalcode.org/project/drupal/-/merge_requests/1430 since part of the change to the color module here causes a problem with garland when not using blue lagoon.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.