Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PHP 8.1 warning in GridGraph.php Deprecated - Implicit conversion from float-string "39.15" to int loses precision #20357

Closed
tsteur opened this issue Feb 13, 2023 · 1 comment · Fixed by #20365
Assignees
Labels
Bug For errors / faults / flaws / inconsistencies etc.
Milestone

Comments

@tsteur
Copy link
Member

tsteur commented Feb 13, 2023

See below warning we got after trying to upgrade Cloud to PHP 8.1:

/var/www/html/plugins/ImageGraph/StaticGraph/GridGraph.php(143): Deprecated - Implicit conversion from float-string "39.15" to int loses precision - Matomo 4.13.3 - Please report this message in the Matomo forums: https://forum.matomo.org (please do a search first as it might have been reported already) #0/plugins/ImageGraph/StaticGraph/GridGraph.php(143),#1/plugins/ImageGraph/StaticGraph/Evolution.php(24),#2/plugins/ImageGraph/API.php(506),[internal function]: Piwik\Plugins\ImageGraph\API->get(),#4/core/API/Proxy.php(244),#5/core/Context.php(28),#6/core/API/Proxy.php(335),#7/core/API/Request.php(267),#8/core/ReportRenderer.php(277),#9/core/ReportRenderer/Html.php(175)

I don't think I have more information unfortunately.

@tsteur tsteur added Potential Bug Something that might be a bug, but needs validation and confirmation it can be reproduced. To Triage An issue awaiting triage by a Matomo core team member labels Feb 13, 2023
@tsteur tsteur changed the title PHP 8.1 warning PHP 8.1 warning in GridGraph.php Deprecated - Implicit conversion from float-string "39.15" to int loses precision Feb 13, 2023
@sgiehl
Copy link
Member

sgiehl commented Feb 14, 2023

@tsteur that one is caused by performing an integer operation on a string that contains a float. I'll prepare a PR to fix that.
I'm pretty sure we will have more and more of such issues with the next PHP versions. PHP is getting more and more type safe, so it only allows to perform certain operations with specific variable types (without triggering warnings). Matomo is handling everything very lax and often doesn't care about types. I'm trying to push everything into a more type safe handling, but it will take a long time to finish that.

@sgiehl sgiehl added Bug For errors / faults / flaws / inconsistencies etc. and removed Potential Bug Something that might be a bug, but needs validation and confirmation it can be reproduced. To Triage An issue awaiting triage by a Matomo core team member labels Feb 14, 2023
@sgiehl sgiehl added this to the 4.13.4 milestone Feb 14, 2023
@sgiehl sgiehl self-assigned this Feb 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug For errors / faults / flaws / inconsistencies etc.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants