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

View Parser - Fix ParsePair() with filter #2499

Merged
merged 1 commit into from
Jan 20, 2020

Conversation

najdanovicivan
Copy link
Contributor

@najdanovicivan najdanovicivan commented Jan 18, 2020

Description
Fixes using filters on properties in arrays

Problem is related to the use of | character in filters as | character is handled as OR in regex. This makes replace singe get multiple matches which in the end leads to multiplied data by number of | characters.

Additionally I have added test case testParsePairWithAbs in ParserFilterTest. Initially I was thinking to modify the existing tests to check for nested array elements as well. But this will require changing almost all the test methods. So I've added the new test method based on testAbs() which checks that abs filter works in various nested array properties

I've noticed some style issue. CodeSniffer replaced

if (count($keyVal) == 2)

to

if (count($keyVal) === 2)

So I also included this change in the commit

This PR Fixes #2360

Checklist:

  • Securely signed commits
  • Component(s) with PHPdocs
  • Unit testing, with >80% coverage
  • User guide updated
  • Conforms to style guide

…roperties in arrays

Problem is related to the use of | charater in filters as | caracter is handled as OR in reges. This makes replace singe get multiple maches wich in the end leads to multipled data by number of | characters.
Copy link
Member

@MGatner MGatner left a comment

Choose a reason for hiding this comment

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

Looks great! Thanks for providing a test with it; quality PR.

@MGatner MGatner merged commit bf69a6e into codeigniter4:develop Jan 20, 2020
@najdanovicivan najdanovicivan deleted the fix-parser branch January 20, 2020 21:07
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.

Bug: with the parser, nl2br in a foreach duplicates entries.
2 participants