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

Correct validation if values are coerced #791

Merged
merged 2 commits into from
Aug 7, 2016

Conversation

darkv
Copy link
Member

@darkv darkv commented Aug 5, 2016

If you are coercing values in your validation methods these value changes could get lost or based on wrong values in some edge cases.
There are three main locations for key related validation:

  1. EO class
  2. Entity userInfo
  3. Partial class

Point 3 could theoretically contain multiple partials even though this should be quite unusual. During 1. and 3. the validated value can be coerced though some of the methods did get the original value instead of the coerced one. This is inconsistent and can lead to data loss which this patch fixes.

this fixes the situation where you have validation rules at multiple places where coerced values could have been lost or the wrong values validated
darkv referenced this pull request Aug 5, 2016
do not throw away return value of _validateValueForKey that is used e.g. in ERXPartialGenericRecord
@paulhoadley
Copy link
Contributor

Looks good to me Johann. I'll merge it tomorrow if there's no further input from anyone.

@paulhoadley paulhoadley merged commit 97803f0 into wocommunity:master Aug 7, 2016
@darkv darkv deleted the validation_patch branch August 8, 2016 06:11
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.

2 participants