Zend Framework

Can't disable locale in IBAN validator

Details

  • Type: Bug Bug
  • Status: Resolved Resolved
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 1.10.5
  • Fix Version/s: 1.10.6
  • Component/s: Zend_Validate
  • Labels:
    None

Description

You can't disable the locale detection in Zend_Validate_Iban when using a Zend_Config (xml).

In xml you need to specify false with a zero.

<validators>
  <iban>
    <validator>Iban</validator>
    <options>
      <locale>0</locale>
    </options>
    </iban>
<validators>

but because the validator checks also the type, you can't disable it.

if ($locale !== false) {
    /* some code */
  }

It works for me by changing the controle to (without type checking)

if ($locale != false) {
    /* some code */
  }

Activity

Hide
Thomas Weidner added a comment -

and why don't you use "auto"?

Show
Thomas Weidner added a comment - and why don't you use "auto"?
Hide
Thomas Weidner added a comment -

Fixed with r22401
Proposed change is problematic. Fixed it differently

Show
Thomas Weidner added a comment - Fixed with r22401 Proposed change is problematic. Fixed it differently
Hide
Bert Van Hauwaert added a comment -

Hello Thomas
Could you explain how I can configure the validator with xml?
From what I see, everything what I can think of just reads the locale out of the registry.
So if I use the config from my original post, I fall in the check

if (empty($locale)) {
	require_once 'Zend/Registry.php';
 	if (Zend_Registry::isRegistered('Zend_Locale')) {
 	   $locale = Zend_Registry::get('Zend_Locale');
 	}
 }

and because that key is defined in my registry, it use that but that is just what I want to avoid.

Show
Bert Van Hauwaert added a comment - Hello Thomas Could you explain how I can configure the validator with xml? From what I see, everything what I can think of just reads the locale out of the registry. So if I use the config from my original post, I fall in the check
if (empty($locale)) {
	require_once 'Zend/Registry.php';
 	if (Zend_Registry::isRegistered('Zend_Locale')) {
 	   $locale = Zend_Registry::get('Zend_Locale');
 	}
 }
and because that key is defined in my registry, it use that but that is just what I want to avoid.

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: