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

violations are not cleared at the beginning of validate() #103

Closed
jacekkarczmarczyk opened this issue Jun 4, 2023 · 4 comments · Fixed by #104
Closed

violations are not cleared at the beginning of validate() #103

jacekkarczmarczyk opened this issue Jun 4, 2023 · 4 comments · Fixed by #104
Labels
bug Something isn't working

Comments

@jacekkarczmarczyk
Copy link
Contributor

Following code was working in 1.x but fails in 2.x because validations array is not cleared:

$validator = new Validator();

if ($validator->validate(/* invalid iban */) || $validator->validate(/* valid iban */)) {
  echo "One of the ibans is correct";
}
@jschaedl
Copy link
Owner

jschaedl commented Jun 4, 2023

Thanks for reporting this. Would you like to provide a fix? Like you said, clearing the violations array at the beginning of the Validator::validate method (https://github.com/jschaedl/iban-validation/blob/master/src/Validator.php#L53) should fix it.

@jschaedl jschaedl added the bug Something isn't working label Jun 4, 2023
@jacekkarczmarczyk
Copy link
Contributor Author

I'll give it a try

@jschaedl
Copy link
Owner

jschaedl commented Jun 5, 2023

@jacekkarczmarczyk
Copy link
Contributor Author

Cheers, thanks for release!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants