Project

General

Profile

Actions

Bug #8836

closed

CBLib Internal library issue: CBLib\Image\Color\stringToRGB() cache indexes not float

Added by beat almost 3 years ago. Updated almost 3 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Target version:
Start date:
20 January 2022
Due date:
% Done:

100%

Estimated time:

Description

Found during PHP 8.1 compatibilty tests and fixes, but as it's a bug, doing a separate tracker item and MR:

Array indices can only be text or int. Floats are casted to ints.

PHP 8.1 issues a nice deprecation warning for this:

Deprecated: Implicit conversion from float 127.5 to int loses precision in /home/beat/cb/git/cb/libraries/CBLib/CBLib/Image/Color.php on line 78
Deprecated: Implicit conversion from float 127.5 to int loses precision in /home/beat/cb/git/cb/libraries/CBLib/CBLib/Image/Color.php on line 84

PHP Manual reference:
https://www.php.net/manual/en/language.types.array.php

As both indices are between 0.0 and 1.0, any values in between are stored only as 0 or 1.

Actions

Also available in: Atom PDF