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

Live.getLastVisitsDetails API sort order different for PHP8 #18234

Closed
AltamashShaikh opened this issue Oct 28, 2021 · 0 comments · Fixed by #18235
Closed

Live.getLastVisitsDetails API sort order different for PHP8 #18234

AltamashShaikh opened this issue Oct 28, 2021 · 0 comments · Fixed by #18235
Assignees
Labels
Bug For errors / faults / flaws / inconsistencies etc. not-in-changelog For issues or pull requests that should not be included in our release changelog on matomo.org.

Comments

@AltamashShaikh
Copy link
Contributor

Due to stable sorting in PHP 8, the result order seems to change when hitting same API on different PHP versions.

Expected Behavior

The output order should be same across all the versions

Current Behavior

The output differs for different PHP versions

Possible Solution

Changing the below code to renturn '-1' instead of '0'
https://github.com/matomo-org/matomo/blob/4.x-dev/plugins/Live/Visitor.php#L309

Steps to Reproduce (for Bugs)

If you have FormAnalytics plugin installed you can try executing the system test cases in PHP8 and the output will differ for you from PHP7.

Context

Trying to add PHP8 in travis build for FormAnalytics plugin and the build is failing due to this

Your Environment

  • Matomo Version:
  • PHP Version:
  • Server Operating System:
  • Additionally installed plugins:
  • Browser:
  • Operating System:
@AltamashShaikh AltamashShaikh added the Potential Bug Something that might be a bug, but needs validation and confirmation it can be reproduced. label Oct 28, 2021
@tsteur tsteur added Bug For errors / faults / flaws / inconsistencies etc. not-in-changelog For issues or pull requests that should not be included in our release changelog on matomo.org. and removed Potential Bug Something that might be a bug, but needs validation and confirmation it can be reproduced. labels Nov 4, 2021
justinvelluppillai pushed a commit that referenced this issue Nov 9, 2021
…Live.getLastVisitsDetails API (#18235)

* Changes to keep sorting order consistent across all php versions, #18234

* Started comparing index instead of returning -1 for visiotor sort, #18234
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. not-in-changelog For issues or pull requests that should not be included in our release changelog on matomo.org.
Projects
None yet
2 participants