zendframework / zend-inputfilter

InputFilter component from Zend Framework
BSD 3-Clause "New" or "Revised" License
64 stars 50 forks source link

Fix missing optional fields should not be validated #25

Closed Maks3w closed 9 years ago

Maks3w commented 9 years ago

Prevent the assumption of null value to be a synonym of value not set. Null values are valid input values (like JSON object with null values)

Maks3w commented 9 years ago

Most basic test does not work due https://github.com/zendframework/zf2/pull/5271/ getRawValues() returns a list of pairs Input => null which make this logic to fail.

svycka commented 9 years ago

I think this explains and fixes https://github.com/zendframework/zf2/issues/6638

Maks3w commented 9 years ago

It's not related. This does not change the meaning of any empty value. This only treat the case when the value is not set (not exists !== empty).

svycka commented 9 years ago

There was impossible to check if value exists or not, so I used notEmpty validator to cover this, but that was not ideal because there was some values treated as empty anyway. This fixes my issue because now I can check not set, is set or not empty, before this PR that was impossible. As I understand this PR adds this functionality.

weierophinney commented 9 years ago

I'm concerned that this changes test assumptions, as that generally indicates a BC break. Looking at the logic, however, it appears sound. I'll review more fully early next week.

Maks3w commented 9 years ago

Note: It's impossible to undo all BC Breaks introduced in ZF 2.4. The split of null between not set and valid value can't be undo.