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

Fix validation of array data #4606

Merged
merged 4 commits into from
Apr 24, 2021

Conversation

paulbalandan
Copy link
Member

@paulbalandan paulbalandan commented Apr 23, 2021

Description
Fixes #4510

This changes the behavior of _array_search_dot. Currently, the function returns early when it matched a non-null element in its value traversal, leaving the remaining elements in the loop as untouched. This PR accumulates the finds in an array, filters out the nulls. If resulting array contains only one element, then we'll return that element instead of an array in order to preserve BC. Otherwise, an array containing matches will be returned.

@luispastendev, can you check this? This passes locally on your use case .

Checklist:

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

@luispastendev
Copy link

luispastendev commented Apr 23, 2021

Thank you very much Paul! I tested the changes and now it works fine, only one detail @WinterSilence detect another use case when an empty array is sent, it evaluates it as true, what do you think about it?

#4510 (comment)

@paulbalandan
Copy link
Member Author

Thank you very much Paul! I tested the changes and now it works fine, only one detail @WinterSilence detect another use case when an empty array is sent, it evaluates it as true, what do you think about it?

#4510 (comment)

My latest push contains some fix for empty arrays. Can you check also?

@paulbalandan paulbalandan changed the title [WIP] Fix validation of array data Fix validation of array data Apr 23, 2021
@luispastendev
Copy link

Perfect I was solved! thank you very much for your time paul!

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.

See my one comment, everything else looks great.

system/Helpers/array_helper.php Show resolved Hide resolved
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.

Array Validation Fails
3 participants