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

[CRITICAL] Break chain is not skipped on success validation result #179

Closed
vova07 opened this issue Jan 25, 2018 · 2 comments
Closed

[CRITICAL] Break chain is not skipped on success validation result #179

vova07 opened this issue Jan 25, 2018 · 2 comments

Comments

@vova07
Copy link
Contributor

vova07 commented Jan 25, 2018

What

In case we have a chain of rules and one of rule will have sett up brick chain, the validation will pass even with wrong data juts because the next rules will be skipped by chain.
The problem is that break chain should be considered only in case the specific rule fail but not always as it is right now. (Expecting Required rule.)

$this
    ->validator
    ->required('foo')
    ->string()
    ->lengthBetween(2, 5);

$result = $this->validator->validate(['foo' => 'abcdefg']);

$isValid = $result->isValid(); // $isValid === true

What is expected

$isValid = $result->isValid(); // $isValid === false

PR to reproduce the bug

#178

PR with a hot fix

#177

@creocoder
Copy link
Contributor

@berry-langerak , @RickvdStaaij Can you please look into this? Without that fix current master contains critical bug.

@rick-nu
Copy link

rick-nu commented Jan 30, 2018

Merged and released:

https://github.com/particle-php/Validator/releases/tag/v2.3.2

Packagist should automatically update again too.

Thanks a lot @vova07! Also thank you @creocoder for the helping hand :) 👍

@rick-nu rick-nu closed this as completed Jan 30, 2018
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

No branches or pull requests

3 participants