AbcAeffchen / SepaUtilities

SepaUtilities provides useful methods for validating and sanitizing inputs used in SEPA files supporting PHP >= 7.2 including PHP 8.
GNU Lesser General Public License v3.0
30 stars 10 forks source link

Improvement: Length of IBAN in Germany #1

Closed dennobaby closed 9 years ago

dennobaby commented 9 years ago

Hi,

in Germany the IBANS have a max lenght of 22 characters. At this moment checkIBAN doesnt care about this...dont know if you would implement this as checkIBAN is an "international" function...

AbcAeffchen commented 9 years ago

checkIBAN checks the input by calculating the checksum. So if you input a german IBAN, the checksum is most likely not valid, if you have added some wrong digits or missed some digits.

I thought about adding a lenght validation, but then I have to add it for many countrys and have too watch out for changes.

Did you input a wrong but valid IBAN by accident?

Maybe I will add an additional (maybe optional) format check for every country using IBANs.

dennobaby commented 9 years ago

Yeah i was playing around with it and did input an IBAN with lenght of 24 characters but with 'DE' in beginning. After checking the file at my banking-institute i saw the error.

AbcAeffchen commented 9 years ago

I added an optional format checking to checkIBAN() which is used by default. It checks the length but also the special IBAN format for about 85 countrys. I think this should prevent nearly every typos.

But notice: It is always possible to input a random IBAN with a valid format and checksum, that does not exist. Only banks can check, if an IBAN realy exist.

I hope this is helpful :smile: