Closed drmmr763 closed 10 months ago
Hey @drmmr763
Thanks for reporting. I've just seen this on one of our projects. Can you confirm which PHP version and Laravel version you are running please? My environment flagged this as a warning, not an exception - but we should still handle it properly. I can see that Laravel is giving us a float, not an int. This has been the case since 2017 too!
In case you are curious, it's being called by here, where we are automatically collecting SQL queries.
Hi @ingalless
8772e509903f:/home/application# php -v PHP 8.1.21 (cli) (built: Jul 10 2023 23:14:30) (NTS) Copyright (c) The PHP Group
"laravel/framework": "^8.0",
When I test trying to force an exception to be tracked I get this error from the trackDependnecy method:
[2023-07-11T20:05:29.277+00:00] local.ERROR: Implicit conversion from float 25.13 to int loses precision {"exception":"[object] (Whoops\\Exception\\ErrorException(code: 8192): Implicit conversion from float 25.13 to int loses precision at /home/application/vendor/mondago/laravel-application-insights/src/ApplicationInsights.php:297)"} []
The method defines
$durationInMilliseconds
as an int, something clearly is trying to shove a float in there. If I update to a decimal it works. I'm not sure actually how this gets called (caller magic?) cause I don't see any references to trackDependency but I may be missing it. Anyway this prevents the exception from being sent successfully to AI.