Skip to content
This repository was archived by the owner on Jan 30, 2020. It is now read-only.

Make symmetric the scenarios when required is true/false #55

Closed
wants to merge 2 commits into from

Conversation

Maks3w
Copy link
Member

@Maks3w Maks3w commented Sep 2, 2015

There is no reason for to have differences when required is true or false and the value is always set.

@Maks3w Maks3w added the BC Break label Sep 2, 2015
@Maks3w Maks3w added this to the 2.4.8 milestone Sep 2, 2015
@Maks3w Maks3w force-pushed the hotfix/symmetric-scenario branch from 030f7e3 to 555e693 Compare September 3, 2015 18:09
@Maks3w Maks3w closed this Sep 3, 2015
@Maks3w Maks3w reopened this Sep 3, 2015
@Maks3w
Copy link
Member Author

Maks3w commented Sep 3, 2015

@weierophinney I've reopen this because restore the behavior of 2.3.

@Maks3w
Copy link
Member Author

Maks3w commented Sep 3, 2015

From 2.3.9 I can upgrade without BC Breaks except for this one and the validator renaming for PHP7 compliance (Int > IsInt)

There is no reason for to have differences when required is true or false and the value is always set.
@Maks3w Maks3w force-pushed the hotfix/symmetric-scenario branch from 555e693 to e7ca878 Compare September 3, 2015 23:02
@Maks3w
Copy link
Member Author

Maks3w commented Sep 3, 2015

Workaround (Recommended, rely on allow_empty:false/continue_if_empty:false is now deprecated):

Before:

array(
    'name' => 'password',
    'required' => false,
    'filters' => array(),
    'validators' => array(),
    'error_message' => 'This field cannot be empty',
    'allow_empty' => true,
    'continue_if_empty' => true,
)

After:

array(
    'name' => 'password',
    'required' => false,
    'filters' => array(),
    'validators' => array(
        0 => array(
            'break_chain_on_failure' => true,
            'name' => 'Zend\\Validator\\NotEmpty',
            'options' => array(),
        ),
    ),
    'error_message' => 'This field cannot be empty',
    'allow_empty' => false,
    'continue_if_empty' => false,
)

@Maks3w
Copy link
Member Author

Maks3w commented Sep 3, 2015

We can again discard this because the feature to fix is now deprecated and workaround exists

@Maks3w Maks3w closed this Sep 5, 2015
weierophinney added a commit to weierophinney/zend-inputfilter that referenced this pull request Sep 8, 2015
Includes these changes:

- [14: NotEmpty validator doesn't override the required attribute](zendframework#14)
- [16: BC in validators context value](zendframework#16)
- [22: Missing required field with fallback does not return input in getValidInput](zendframework#22)
- [24: Fix loop validation input context is mutable](zendframework#24)
- [25: Fix missing optional fields should not be validated](zendframework#25)
- [32: Promote HHVM](zendframework#32)
- [36: Fix docblocks declared as regular comment block](zendframework#36)
- [40: Remove test about Input setters permutation](zendframework#40)
- [41: Refactor tests for group 7448 as a data set matrix](zendframework#41)
- [42: Consolidate InputFilterPluginManager tests](zendframework#42)
- [43: Consolidate Factory tests + Fixes](zendframework#43)
- [44: Consolidate of InputInterface::merge and Fix unsafe merge](zendframework#44)
- [45: When merge Inputs don't merge values if source does not have one.](zendframework#45)
- [46: Expand test matrix with nonempty value scenarios](zendframework#46)
- [47: Feature/minor test improvements](zendframework#47)
- [48: Empty values + Allow Empty + Not continue if empty is always true](zendframework#48)
- [49: Add tests for exceptions and improve some messages](zendframework#49)
- [50: Optional fields without value should be valid ](zendframework#50)
- [51: Optional input without value are valid](zendframework#51)
- [52: Fix merge two inputs without value, result 'has value' flag should be false](zendframework#52)
- [53: Tune NonEmpty options for detect the expected empty values](zendframework#53)
- [55: Make symmetric the scenarios when required is true/false](zendframework#55)
- [56: Hotfix/minor changes](zendframework#56)
- [57: Consolidate tests for InputFilterInterface](zendframework#57)
- [61: Provide NotEmpty::IS&zendframework#95;EMPTY validation message for required input](zendframework#61)
- [63: Ensure custom error messages are used for required missing inputs](zendframework#63)
- [64: Feature/test cleanup](zendframework#64)
@Maks3w Maks3w deleted the hotfix/symmetric-scenario branch September 10, 2015 07:39
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant