matomo-org / matomo

Empowering People Ethically with the leading open source alternative to Google Analytics that gives you full control over your data. Matomo lets you easily collect data from websites & apps and visualise this data and extract insights. Privacy is built-in. Liberating Web Analytics. Star us on Github? +1. And we love Pull Requests!
https://matomo.org/
GNU General Public License v3.0
19.71k stars 2.62k forks source link

Non-utf8 setlocale can result in Fatal Error #18570

Open Starker3 opened 2 years ago

Starker3 commented 2 years ago

A user that has a non-utf8 locale set in their PHP configuration, for example:

export LC_ALL=fr_FR

export LANG=fr_FR

Can result in reports or tracking requests with non-utf8 character encoding being generated/inserted. For example: image

This was fixed for this user by setting the following in the PHP configuration:

export LC_ALL=fr_FR.utf8

export LANG=fr_FR.utf8

Not sure if this is something that we could add a system check for or prevent in some other way?

Edit: This is the PHP configuration for the Matomo server, not the website being tracked.

Starker3 commented 2 years ago

Further clarification from the user, this can result in a Fatal Error when trying to show reports in the UI: image

It seems that this is now happening when after switching to the following PHP configuration:

export LC_ALL=fr_FR.utf8

export LANG=fr_FR.utf8

Will ask for further clarification to confirm this.

Starker3 commented 2 years ago

FYI the character that likely caused this was: %C3%89 Eg.

https://somedomain.tld/somepage.php?name=ABC%20D%C3%89%20%28FG1234%3AXYZ%29
sgiehl commented 2 years ago

@Starker3 do you know if the user is using utf8mb4 for database tables?