Skip to content

Avoid escaping of characters other than " #21

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

Merged
merged 3 commits into from
Nov 9, 2022
Merged

Avoid escaping of characters other than " #21

merged 3 commits into from
Nov 9, 2022

Conversation

sgiehl
Copy link
Member

@sgiehl sgiehl commented Oct 26, 2022

Description:

replaces #20
refs matomo-org/matomo#19899

Review

Comment on lines +287 to +295
if (preg_match('/^"(.*)"$/', $value)) {
$value = preg_replace('/^"(.*)"$/', '$1', $value);
$value = str_replace('\"', '"', $value);
} elseif (preg_match("/^'(.*)'$/", $value)) {
$value = preg_replace("/^'(.*)'$/", '$1', $value);
$value = str_replace("\'", "'", $value);
} else {
$value = trim($value, "'\"");
}
Copy link
Member Author

Choose a reason for hiding this comment

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

This actually fixes some difference between this reader implementation and parse_ini_string.
Values like key = "test \" test" or key = "' test" resulted in different results. This should be covered by the additional tests

Copy link

@peterhashair peterhashair left a comment

Choose a reason for hiding this comment

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

Looks good to me.

@justinvelluppillai
Copy link

@peterhashair @sgiehl any reason this isn't merged if it is fully tested and reviewed?

@peterhashair
Copy link

peterhashair commented Nov 9, 2022

@justinvelluppillai not sure if there is any special process for this repo, but looks good to me to do a merge.

@sgiehl sgiehl merged commit b55c55d into master Nov 9, 2022
@sgiehl sgiehl deleted the fix branch November 9, 2022 08:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants