Inconsistency in some property types of Actions.getPageTitles API #19963
Labels
c: Tests & QA
For issues related to automated tests or making it easier to QA & test issues.
Milestone
I was updating the WhiteLabel premium plugin to build using PHP 8.1 instead of 8.0 and found that the
entry_nb_uniq_visitors
andexit_nb_uniq_visitors
properties were previously string values and changed to Integer values when using PHP 8.1. I was able to fix the build by having two separate JSON files depending on which PHP version is running, but @mattab made the point that it's better to cast the values to keep them consistent.Expected Behavior
When I make the following API call, it should return the same result whether I'm using PHP 8.1 or and earlier version:
https://{myMatomoDomain}/index.php?module=API&format=JSON&idSite=1&period=day&date=2022-10-07&method=Actions.getPageTitles&token_auth={myAuthToken}
Current Behavior
When I make the following API call, the
entry_nb_uniq_visitors
andexit_nb_uniq_visitors
properties change typed depending on whether I'm using PHP 8.1 or and earlier version:https://{myMatomoDomain}/index.php?module=API&format=JSON&idSite=1&period=day&date=2022-10-07&method=Actions.getPageTitles&token_auth={myAuthToken}
Possible Solution
As mentioned above, Matt suggested casting the properties to the expected type to keep the response consistent.
Steps to Reproduce (for Bugs)
Context
This broke the WhiteLabel build when I updated it from 8.0 to 8.1. We don't want to break things for clients when they upgrade PHP versions. This is just one API example, but there are probably others.
Your Environment
The text was updated successfully, but these errors were encountered: