소스 검색

[ZF-7703] Zend_Int:

- invalidating locale 'en' on locale usage

git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@18097 44c647ce-9c0f-0410-b52a-842ac1e357ba
thomas 16 년 전
부모
커밋
2d8dae7bab
2개의 변경된 파일12개의 추가작업 그리고 2개의 파일을 삭제
  1. 1 2
      library/Zend/Validate/Int.php
  2. 11 0
      tests/Zend/Validate/IntTest.php

+ 1 - 2
library/Zend/Validate/Int.php

@@ -127,8 +127,7 @@ class Zend_Validate_Int extends Zend_Validate_Abstract
 
         } else {
             try {
-                if (!Zend_Locale_Format::isInteger($value, array('locale' => 'en')) &&
-                    !Zend_Locale_Format::isInteger($value, array('locale' => $this->_locale))) {
+                if (!Zend_Locale_Format::isInteger($value, array('locale' => $this->_locale))) {
                     $this->_error(self::NOT_INT);
                     return false;
                 }

+ 11 - 0
tests/Zend/Validate/IntTest.php

@@ -124,4 +124,15 @@ class Zend_Validate_IntTest extends PHPUnit_Framework_TestCase
         $valid = new Zend_Validate_Int();
         $this->assertTrue($valid->isValid('10.000'));
     }
+
+    /**
+     * @ZF-7703
+     */
+    public function testLocaleDetectsNoEnglishLocaleOnOtherSetLocale()
+    {
+        Zend_Registry::set('Zend_Locale', new Zend_Locale('de'));
+        $valid = new Zend_Validate_Int();
+        $this->assertTrue($valid->isValid(1200));
+        $this->assertFalse($valid->isValid('1,200'));
+    }
 }