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

Sparkline: Fix value sanitizing #14908

Merged
merged 1 commit into from Sep 26, 2019

Conversation

MichaelRoosz
Copy link
Contributor

My last pull request (#14901) tried to fix the problem of values with spaces at the end in the Sparkline class (making the values "non-numeric").

While doing some more debugging I also encountered "non-breaking" spaces in some values, which the trim() function (my previous fix) does not remove.

These special spaces are hard to remove, because they sometimes are encoded in ISO/ASCII (hex 0xA0) as well as UTF-8 (hex 0xC2 0xA0). Without making use of the mb_* functions it will be hard to remove all of them while not damaging utf-8 strings.

This PR tries to solve the problem by making use of filter_var() to sanitize the value and remove all non-numeric characters.

See also #14662 (comment)

@tsteur
Copy link
Member

tsteur commented Sep 26, 2019

Cheers @MichaelHeerklotz very appreciated

@tsteur tsteur merged commit eec541a into matomo-org:3.x-dev Sep 26, 2019
@MichaelRoosz MichaelRoosz deleted the sparkline-fix-2 branch October 29, 2023 13:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants