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

Prevent error in OptOutManager when language is not a string #20074

Merged
merged 1 commit into from Dec 5, 2022

Conversation

tsteur
Copy link
Member

@tsteur tsteur commented Dec 4, 2022

Had the other day close to 80 fatal errors from a scanner where language was not a string which resulted in an error below

preg_match(): Argument #2 ($subject) must be of type string, array given
Error: {"message":"preg_match(): Argument #2 ($subject) must be of type string, array given","file":"core/Filesystem.php","line":79,"request_id":"96ae7","backtrace":" on core/Filesystem.php(79)\n#0 core/Filesystem.php(79): preg_match('/(^[a-zA-Z0-9]+...', Array)\n#1 plugins/LanguagesManager/API.php(48): Piwik\Filesystem::isValidFilename(Array)\n#2 plugins/CoreAdminHome/OptOutManager.php(560):

Example URL: /index.php?action=optOut&backgroundColor=&fontColor=333333&fontFamily=Arial&fontSize=16px&language%5B0%5D=%3Dconvert%28int%2Csys.fn_sqlvarbasetostr%28HashBytes%28%27MD5%27%2C%271476824053%27%29%29%29and+3+in+&language%5B1%5D=3&module=CoreAdminHome

Review

Had the other day close to 80 fatal errors from a scanner where language was not a string which resulted in an error below

> preg_match(): Argument #2 ($subject) must be of type string, array given
@tsteur tsteur added the Needs Review PRs that need a code review label Dec 4, 2022
@tsteur tsteur added this to the 4.13.1 milestone Dec 4, 2022
@mattab mattab modified the milestones: 4.13.1, 5.0.0 Dec 5, 2022
Copy link
Contributor

@bx80 bx80 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Recreated the error on 4.x-dev using test URL, no error with the test URL after this fix 👍

@bx80 bx80 merged commit e7ab21f into 4.x-dev Dec 5, 2022
@bx80 bx80 deleted the optoutlanguage branch December 5, 2022 00:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs Review PRs that need a code review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants