symfony / symfony

The Symfony PHP framework
https://symfony.com
MIT License
29.47k stars 9.41k forks source link

[Validator] IbanValidator validates `iran` ibans as valid but swift doesn't see them as valid #46919

Closed JohJohan closed 1 year ago

JohJohan commented 1 year ago

Symfony version(s) affected

*

Description

The IbanValidator validates iran ibans as valid but swift doesn't see them as valid. See swift docs (which we also mention in IbanValidator class on FORMATS: https://www.swift.com/sites/default/files/resources/iban_registry.pdf it doesn't mention iran anymore.

How to reproduce

Fill in a iran iban and it should be invalid but now its valid.

Possible Solution

We should probably remove iran in the validator so that they are seen as invalid so we are consistent with swift.

Additional Context

Maybe Swift isn't updating there resources as in a news article they mention it should be active: https://www.swift.com/insights/press-releases/swift-instructed-to-disconnect-sanctioned-iranian-banks-following-eu-council-decision more info here: https://www.swift.com/fr/node/11306

Ahummeling commented 1 year ago

The way I see it, an IbanValidator should validate whether an iban is valid, not whether the country is currently supported. A valid iban should always be valid, regardless of its relationship with swift. However, whether that iban is supported, whether it is active, that is something that may be changed and thus cannot be validated in the same way.

fabpot commented 1 year ago

I agree with @Ahummeling

xabbuh commented 1 year ago

@JohJohan You may want to take a look into jschaedl/iban-validation (but please note jschaedl/iban-validation#79).