ZF-10556: Zend_Validate_Iban(array('locale' => false)) does not function see description for solution


IMHO to solve the problem you souhould change the line 125 in Iban.php FROM: if (empty($locale)) { TO: if (empty($locale) && $locale != false) {

greetings Michael


Fixed in ZF2 with GH-316


sorry to wake this bug up, but this hasn't made to the 1.12 release. It still isn't possible to validate an IBAN without restriction to a country like the doc says : http://zendframework.com/manual/1.12/…

Could it be backported to 1.11 and 1.12 ?

Here is a code test it with php-cli :


ini_set('include_path', '.:/tmp/ZendFramework-1.12.0-minimal/library');

// I try to simulate a full Zend, launched from a browser.
// Not very clean, maybe :)
require_once 'Zend/Validate/Iban.php';
require_once 'Zend/Locale.php';
require_once 'Zend/Registry.php';
Zend_Registry::set('Zend_Locale', new Zend_Locale);

// Code pasted from doc
$validator = new Zend_Validate_Iban(array('locale' => false));

if ($validator->isValid('AT611904300234573201')) {
    echo "IBAN appears to be valid.\n";
} else {
    echo "IBAN is not valid.\n";

Launch it with :

HTTP_ACCEPT_LANGUAGE="de_AT" php test.php
HTTP_ACCEPT_LANGUAGE="fr_FR" php test.php

NB : got a stacktrace with...

HTTP_ACCEPT_LANGUAGE="fr" php test.php

...which appears legal, no ?