Issues

ZF-12531: Zend_Validate_Iban is missing a lot of countries

Issue Type: Bug Created: 2013-02-27T19:19:40.000+0000 Last Updated: 2013-03-12T14:36:24.000+0000 Status: In Progress Fix version(s): Reporter: Simon Stücher (billomat) Assignee: None Tags: - Zend_Validate

  • iban

Related issues: Attachments: - Validate.diff

Description

Zend_Validate_Iban only implements regexes for 39 countries, but there are 62. The remaining 23 countries should also be implemented.

See http://swift.com/dsp/resources/…

Comments

Posted by Markus Möller (derlangemarkus) on 2013-02-28T07:07:40.000+0000

Unfortunately I didn't find a way to submit a bugfix yet.

Just replace the $_ibanregex in Zend_Validate_Iban with these lines:

protected $_ibanregex = array(
    'AD' => '/^AD[0-9]{2}[0-9]{8}[A-Z0-9]{12}$/',
    'AE' => '/^AE[0-9]{2}[0-9]{3}[0-9]{16}$/',
    'AL' => '/^AL[0-9]{2}[0-9]{8}[A-Z0-9]{16}$/',
    'AT' => '/^AT[0-9]{2}[0-9]{5}[0-9]{11}$/',
    'AZ' => '/^AZ[0-9]{2}[0-9]{4}[A-Z0-9]{20}$/',
    'BA' => '/^BA[0-9]{2}[0-9]{6}[0-9]{10}$/',
    'BE' => '/^BE[0-9]{2}[0-9]{3}[0-9]{9}$/',
    'BG' => '/^BG[0-9]{2}[A-Z]{4}[0-9]{4}[0-9]{2}[A-Z0-9]{8}$/',
    'BH' => '/^BH[0-9]{2}[A-Z]{4}[A-Z0-9]{14}$/',
    'BR' => '/^BR[0-9]{2}[0-9]{8}[0-9]{5}[0-9]{10}[A-Z]{1}[A-Z0-9]{1}$/',
    'CH' => '/^CH[0-9]{2}[0-9]{5}[A-Z0-9]{12}$/',
    'CR' => '/^CR[0-9]{2}[0-9]{3}[0-9]{14}$/',
    'CS' => '/^CS[0-9]{2}[0-9]{3}[0-9]{15}$/',
    'CY' => '/^CY[0-9]{2}[0-9]{8}[A-Z0-9]{16}$/',
    'CZ' => '/^CZ[0-9]{2}[0-9]{4}[0-9]{16}$/',
    'DE' => '/^DE[0-9]{2}[0-9]{8}[0-9]{10}$/',
    'DK' => '/^DK[0-9]{2}[0-9]{4}[0-9]{10}$/',
    'DO' => '/^DO[0-9]{2}[A-Z0-9]{4}[0-9]{20}$/',
    'EE' => '/^EE[0-9]{2}[0-9]{4}[0-9]{12}$/',
    'ES' => '/^ES[0-9]{2}[0-9]{8}[0-9]{12}$/',
    'FR' => '/^FR[0-9]{2}[0-9]{10}[A-Z0-9]{11}[0-9]{2}$/',
    'FI' => '/^FI[0-9]{2}[0-9]{6}[0-9]{8}$/',
    'FO' => '/^FO[0-9]{2}[0-9]{4}[0-9]{9}[0-9]{1}$/',
    'GB' => '/^GB[0-9]{2}[A-Z]{4}[0-9]{14}$/',
    'GE' => '/^GE[0-9]{2}[A-Z]{2}[0-9]{16}$/',
    'GI' => '/^GI[0-9]{2}[A-Z]{4}[A-Z0-9]{15}$/',
    'GL' => '/^GL[0-9]{2}[0-9]{4}[0-9]{9}[0-9]{1}$/',
    'GR' => '/^GR[0-9]{2}[0-9]{7}[A-Z0-9]{16}$/',
    'GT' => '/^GT[0-9]{2}[A-Z0-9]{4}[A-Z0-9]{20}$/',
    'HR' => '/^HR[0-9]{2}[0-9]{7}[0-9]{10}$/',
    'HU' => '/^HU[0-9]{2}[0-9]{7}[0-9]{1}[0-9]{15}[0-9]{1}$/',
    'IE' => '/^IE[0-9]{2}[A-Z0-9]{4}[0-9]{6}[0-9]{8}$/',
    'IL' => '/^IL[0-9]{2}[0-9]{3}[0-9]{3}[0-9]{13}$/',
    'IS' => '/^IS[0-9]{2}[0-9]{4}[0-9]{18}$/',
    'IT' => '/^IT[0-9]{2}[A-Z]{1}[0-9]{10}[A-Z0-9]{12}$/',
    'KW' => '/^KW[0-9]{2}[A-Z]{4}[0-9]{3}[0-9]{22}$/',
    'KZ' => '/^KZ[A-Z]{2}[0-9]{2}[0-9]{3}[A-Z0-9]{13}$/',
    'LB' => '/^LB[0-9]{2}[0-9]{4}[A-Z0-9]{20}$/',
    'LI' => '/^LI[0-9]{2}[0-9]{5}[A-Z0-9]{12}$/',
    'LU' => '/^LU[0-9]{2}[0-9]{3}[A-Z0-9]{13}$/',
    'LT' => '/^LT[0-9]{2}[0-9]{5}[0-9]{11}$/',
    'LV' => '/^LV[0-9]{2}[A-Z]{4}[A-Z0-9]{13}$/',
    'MC' => '/^MC[0-9]{2}[0-9]{5}[0-9]{5}[A-Z0-9]{11}[0-9]{2}$/',
    'MD' => '/^MD[0-9]{2}[A-Z0-9]{20}$/',
    'ME' => '/^ME[0-9]{2}[0-9]{3}[0-9]{13}[0-9]{2}$/',
    'MK' => '/^MK[0-9]{2}[A-Z]{3}[A-Z0-9]{10}[0-9]{2}$/',
    'MR' => '/^MR13[0-9]{5}[0-9]{5}[0-9]{11}[0-9]{2}$/',
    'MU' => '/^MU[0-9]{2}[A-Z]{4}[0-9]{2}[0-9]{2}[0-9]{12}[0-9]{3}[A-Z]{2}$/',
    'MT' => '/^MT[0-9]{2}[A-Z]{4}[0-9]{5}[A-Z0-9]{18}$/',
    'NL' => '/^NL[0-9]{2}[A-Z]{4}[0-9]{10}$/',
    'NO' => '/^NO[0-9]{2}[0-9]{4}[0-9]{7}$/',
    'PK' => '/^PK[0-9]{2}[A-Z]{4}[0-9]{16}$/',
    'PL' => '/^PL[0-9]{2}[0-9]{8}[0-9]{16}$/',
    'PS' => '/^PS[0-9]{2}[A-Z]{4}[0-9]{21}$/',
    'PT' => '/^PT[0-9]{2}[0-9]{8}[0-9]{13}$/',
    'RO' => '/^RO[0-9]{2}[A-Z]{4}[A-Z0-9]{16}$/',
    'RS' => '/^RS[0-9]{2}[0-9]{3}[0-9]{13}[0-9]{2}$/',
    'SA' => '/^SA[0-9]{2}[0-9]{2}[A-Z0-9]{18}$/',
    'SE' => '/^SE[0-9]{2}[0-9]{3}[0-9]{17}$/',
    'SI' => '/^SI[0-9]{2}[0-9]{5}[0-9]{8}[0-9]{2}$/',
    'SK' => '/^SK[0-9]{2}[0-9]{4}[0-9]{16}$/',
    'SM' => '/^SM[0-9]{2}[A-Z]{1}[0-9]{5}[0-9]{5}[A-Z0-9]{12}$/',
    'TN' => '/^TN[0-9]{2}[0-9]{5}[0-9]{15}$/',
    'TR' => '/^TR[0-9]{2}[0-9]{5}[A-Z0-9]{17}$/',
    'VG' => '/^VG[0-9]{2}[A-Z]{4}[0-9]{16}$/'
);

Posted by Simon Stücher (billomat) on 2013-03-12T13:58:08.000+0000

Patch attached.

Posted by Simon Stücher (billomat) on 2013-03-12T14:07:15.000+0000

Not quite shure if I can commit the patch by myself and how the workflow is. Seems that Thomas is responsible for the Validate Component. Can you manage this?

Posted by Frank Brückner (frosch) on 2013-03-12T14:36:24.000+0000

@[~billomat] Thomas no longer works for the ZF project.

Have you found an issue?

See the Overview section for more details.

Copyright

© 2006-2016 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.

Contacts