ZF-8001: Zend_Validate_Int ignores a locale param

Issue Type: Bug Created: 2009-10-01T20:05:24.000+0000 Last Updated: 2012-06-12T09:42:42.000+0000 Status: Resolved Fix version(s): - 1.10.0 (27/Jan/10)

Reporter: Oleg Demeshev (01eg) Assignee: Thomas Weidner (thomas) Tags: - Zend_Validate

Related issues: Attachments:


$validator = new Zend_Validate_Int(); $value = '23'; if ($validator->isValid($value)) { echo('ok'); } else { echo('not ok'); }

$validator = new Zend_Validate_Int("en_NZ"); $value = '23'; if ($validator->isValid($value)) { echo('ok'); } else { echo('not ok'); }

in the both samples return "ok", but in the second sample ignores a user locale parameter (en_NZ). I can attach a Xdebug trace file is necessary.


... public function __construct($locale = null) { $this->setLocale($locale); } ... public function setLocale($locale = null) {

    if (!is_null($locale)) {
        require_once 'Zend/Locale.php';
        $this->_locale = Zend_Locale::findLocale($locale);
    } else {
        $this->_locale = $locale;
    return $this;



Posted by Thomas Weidner (thomas) on 2009-10-01T23:47:48.000+0000

Check your installation. Locale usage is available since 1.8. The code you gave is available in 1.9.

Btw: For Int detection "23" works always... there is no localized difference between "23" in french or german and "23" in english.

Posted by Tiago Seabra (tseabra) on 2012-06-12T09:42:42.000+0000

On ZF 1.11.11 i tried this

$value = '9'; $validator = new Zend_Validate_Int('en_EN'); echo 'int ---> '; echo ($validator->isValid($value))?'ok':'not ok'; echo '
'; $validator = new Zend_Validate_Int("en_IN"); echo 'int IN ---> '; echo ($validator->isValid($value))?'ok':'not ok';

---------------output int ---> ok int IN ---> not ok

Have you found an issue?

See the Overview section for more details.


© 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.