Open tsteur opened 1 year ago
This is yet another issue with numbers that a formatted to early. The ImageGraph fetches the numbers formatted from the database. Using those for calculations might result in failures. There is actually some code, that tries to convert the formatted number back to something usable:
But this part actually might result in a invalid number. The error above seems to come from a revenue like 1,401.53 $
. The code removes the currency and replaces the ,
with .
. So the number being used i 1.401.53
, which can't work.
I tried simply using the unformatted metrics for ImageGraph (see https://github.com/matomo-org/matomo/compare/m19940?expand=1), which fixes the problem above. But that means that most percent values, like conversion rate, are then not formatted at all and are used as their rate value, e.g. 0.15
instead of 15
This is actually a more general problem. Not sure if we already have a extra issue about that or only discussed that on various other ones. But the percentage metrics should actually not do any calculations while formatting. We might need to implement a way, that those metrics are always "calculated" automatically and formatted only when needed.
Do we now have an issue tracking the more general case @sgiehl, or could you please create one?
FYI this happened again a few times in GridGraph.php . Not BaseDraw.php
Thanks @tsteur, yep, that was raised in #20616 which I linked to this issue and marked as duplicate due to the same symptoms and that it will be resolved at the same time.
This has happened again in ceil(): Argument #1 ($num) must be of type int|float, string given","file":"/plugins\/ImageGraph\/StaticGraph\/GridGraph.php","line":137,"
This happened again: Error: {"message":"ceil(): Argument #1 ($num) must be of type int|float, string given","file":"/plugins\/ImageGraph\/StaticGraph\/GridGraph.php","line":137
This happened again
I've seen multiple reports of this in cloud alerts/logs.
I've got a bit more info to add. Of all the alerts the majority are from the user agents (edited) Dalvik.../Android
and Appcelerator Titanium/@"0.0.0" (iPhone...)
.
Also, as far as I can see they are mostly date ranges.
Payload example:
"module": "API",
"method": "ImageGraph.get",
"idSite": "1",
"apiModule": "Goals",
"apiAction": "get",
"token_auth": "...",
"idGoal": "ecommerceOrder",
"period": "day",
"date": "2022-09-01,2022-11-01",
"filter_sort_column": "revenue",
"column": "revenue",
"columns": "revenue",
"language": "en",
"width": "900",
"height": "450",
"fontSize": "25",
"showMetricTitle": "0",
"aliasedGraph": "1",
"legendAppendMetric": "0",
"backgroundColor": "efefef",
"gridColor": "dcdcdc",
"colors": "3450A3,43a047",
"legendFontSize": "25",
"cacherand": "1111111",
"filter_limit": 100
}
This happened again
This happened again
This happened again
This is still happening regularly
This is still happening
This error is still happening in Matomo 5. Users are still running into this bug. Also happened Oct 24th and Oct 23rd and Oct 21st.
Note that below is about GridGraph.php and not BaseDraw.php. I comment them in here as my other specific issue for this in https://github.com/matomo-org/matomo/issues/20616 was closed with a reference being a duplicate.
Can we have a fix for this some time? cc @Stan-vw
Error: {"message":"ceil(): Argument #1 ($num) must be of type int|float, string given","file":"\/plugins\/ImageGraph\/StaticGraph\/GridGraph.php","line":137,"request_id":"4d5dd","backtrace":" on \/plugins\/ImageGraph\/StaticGraph\/GridGraph.php(137)\n#0 \/plugins\/ImageGraph\/StaticGraph\/GridGraph.php(137): ceil('8.841.60')\n#1 \/plugins\/ImageGraph\/StaticGraph\/Evolution.php(24): Piwik\Plugins\ImageGraph\StaticGraph\GridGraph->initGridChart(true, 691053, false, true, true)\n#2 \/plugins\/ImageGraph\/API.php(504): Piwik\Plugins\ImageGraph\StaticGraph\Evolution->renderGraph()\n#3 [internal function]: Piwik\Plugins\ImageGraph\API->get(5, 'day', 'last7', 'Goals', 'get', 'evolution', 0, 'revenue', false, true, 996, 394, '24', '24', '1', 'ecommerceOrder', '3450A3,43a047', '222222', 'efefef', 'dcdcdc', false, '0', false, false)\n#4 \/core\/API\/Proxy.php(255): call_user_func_array(Array, Array)\n#5 \/core\/Context.php(28): Piwik\API\Proxy->Piwik\API\{closure}()\n#6 \/core\/API\/Proxy.php(346): Piwik\Context::executeWithQueryParameters(Array, Object(Closure))\n#7 \/core\/API\/Request.php(272): Piwik\API\Proxy->call('\\Piwik\\Plugins\\...', 'get', Array)\n#8 \/plugins\/API\/Controller.php(45): Piwik\API\Request->process()\n#9 [internal function]: Piwik\Plugins\API\Controller->index()\n#10 \/core\/FrontController.php(637): call_user_func_array(Array, Array)\n#11 \/core\/FrontController.php(169): Piwik\FrontController->doDispatch('API', false, Array)\n#12 \/core\/dispatch.php(32): Piwik\FrontController->dispatch()\n#13 \/index.php(25): require_once('\/c...')\n#14 {main}","safemode_backtrace":"#0 [internal function]: Piwik\Plugins\Cloud\Controller->safemode(Array)\n#1 \/core\/FrontController.php(637): call_user_func_array(Array, Array)\n#2 \/core\/FrontController.php(16
This is still happening multiple times per week for customers
Looking at GridGraph L137, we use ceil
method there. That can take strings as long as they can be converted to numbers, so the issue here would be that we have a non-numeric string in the data, or a number that has been double sanitised or wrongly encoded/decoded and ended up e.g. with two decimal dots or so.
I understand from the team that it's blocked by https://github.com/matomo-org/matomo/issues/20701 which isn't a quick fix
This just happened again quite a few times:
Error: {"message":"ceil(): Argument #1 ($num) must be of type int|float, string given","file":"\/plugins\/ImageGraph\/StaticGraph\/GridGraph.php","line":137,"request_id":"f27fd","backtrace":" on \/plugins\/ImageGraph\/StaticGraph\/GridGraph.php(137)\n#0 \/plugins\/ImageGraph\/StaticGraph\/GridGraph.php(137): ceil('0.0.0.0')
See details below:
URL: /index.php?module=API&method=ImageGraph.get&idSite=1&apiModule=Goals&apiAction=get&token_auth=XYZANONYMIZED&idGoal=ecommerceOrder&period=day&date=2022-10-03,2022-11-01&filter_sort_column=revenue&column=revenue&columns=revenue&language=en&width=984&height=450&fontSize=27&showMetricTitle=0&aliasedGraph=1&legendAppendMetric=0&backgroundColor=efefef&gridColor=dcdcdc&colors=3450A3%2C43a047&legendFontSize=27&cacherand=7280344