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

Iban validation fails for some formats #180

Open
mediaessenz opened this issue Apr 18, 2023 · 0 comments
Open

Iban validation fails for some formats #180

mediaessenz opened this issue Apr 18, 2023 · 0 comments

Comments

@mediaessenz
Copy link

Due to a problem (bug?) under PHP 8.1 the last function call (bcmod) throw an error, but no exception:

return '1' === bcmod($check, 97, 0);

This way, a invalid IBAN like "DE)$270200011511683151" will result in a program interuption with no chance to catch them – even not with a try-catch!

To fix this problem, I suggest to add a pre check like this:

if (!is_numeric($check)) {
    return false;
}
return '1' === bcmod($check, 97, 0);
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

1 participant