-
Notifications
You must be signed in to change notification settings - Fork 3
Description
I have received the following bug report recently:
http://apps.openbudgets.eu/cube/analytics/bonn-budget-2022-PSPelement__2603c/descriptive_statistics/facts?amounts=amount&dimensions=operationCharacter.prefLabel%7CprofitCenter.prefLabel%7CbusinessArea.prefLabel%7CeconomicClassification.prefLabel%7Corganization.organization&json_data=http%3A%2F%2Fapps.openbudgets.eu%2Fapi%2F3%2Fcubes%2Fbonn-budget-2022-PSPelement__2603c%2Ffacts%3F
(Error: lexical error: invalid char in json text. und Versicherungen","amount":NAN},{"operationCharacter.prefL (right here) ------^ In call: parse_con(txt, bigint_as_char))
It is caused by a NAN (not a number) being literally dumped as-is by PHP's json_encode function. NAN is a valid structure in PHP, but it has no valid meaning in a JSON serialization.
PHP docs state that there is a constant to provide as an option so that INF (infinity) and NAN (not a number) are substituted with zeros during the serialization. I tried the following chunk of code:
<?php
echo json_encode(["a" => INF, "b"=> NAN],JSON_ERROR_INF_OR_NAN | JSON_PARTIAL_OUTPUT_ON_ERROR | JSON_PRETTY_PRINT );
?>In my local Windows PHP 7.0 installation, the above correctly resulted in {"a":0, "b":0}. In our docker image, INF was correctly converted to 0, but NAN remained as-is. I tried manually updating the php7 version in the running instance to PHP 7.1 and it worked correctly. It seems it was a bug and it got fixed.
While I could update PHP myself, this might result to some error driving the server out of order. So, @wk0206 can you or someone else just update the Rudolf docker image to a newer (7.1) version?