瀏覽代碼

[ZF-7153] Zend_Validate:

- added missing classes 

git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@20182 44c647ce-9c0f-0410-b52a-842ac1e357ba
thomas 16 年之前
父節點
當前提交
dba13c4b6f

+ 4 - 2
library/Zend/Validate/Alnum.php

@@ -72,11 +72,13 @@ class Zend_Validate_Alnum extends Zend_Validate_Abstract
     {
         if ($allowWhiteSpace instanceof Zend_Config) {
             $allowWhiteSpace = $allowWhiteSpace->toArray();
+        }
+
+        if (is_array($allowWhiteSpace)) {
             if (array_key_exists('allowWhiteSpace', $allowWhiteSpace)) {
                 $allowWhiteSpace = $allowWhiteSpace['allowWhiteSpace'];
             } else {
-                require_once 'Zend/Validate/Exception.php';
-                throw new Zend_Validate_Exception("Missing option 'allowWhiteSpace'");
+                $allowWhiteSpace = false;
             }
         }
 

+ 4 - 2
library/Zend/Validate/Alpha.php

@@ -72,11 +72,13 @@ class Zend_Validate_Alpha extends Zend_Validate_Abstract
     {
         if ($allowWhiteSpace instanceof Zend_Config) {
             $allowWhiteSpace = $allowWhiteSpace->toArray();
+        }
+
+        if (is_array($allowWhiteSpace)) {
             if (array_key_exists('allowWhiteSpace', $allowWhiteSpace)) {
                 $allowWhiteSpace = $allowWhiteSpace['allowWhiteSpace'];
             } else {
-                require_once 'Zend/Validate/Exception.php';
-                throw new Zend_Validate_Exception("Missing option 'allowWhiteSpace'");
+                $allowWhiteSpace = false;
             }
         }
 

+ 4 - 6
library/Zend/Validate/Float.php

@@ -59,12 +59,10 @@ class Zend_Validate_Float extends Zend_Validate_Abstract
     {
         if ($locale instanceof Zend_Config) {
             $locale = $locale->toArray();
-            if (array_key_exists('locale', $locale)) {
-                $locale = $locale['locale'];
-            } else {
-                require_once 'Zend/Validate/Exception.php';
-                throw new Zend_Validate_Exception("Missing option 'locale'");
-            }
+        }
+
+        if (is_array($locale) && array_key_exists('locale', $locale)) {
+            $locale = $locale['locale'];
         }
 
         if ($locale === null) {

+ 3 - 0
library/Zend/Validate/GreaterThan.php

@@ -66,6 +66,9 @@ class Zend_Validate_GreaterThan extends Zend_Validate_Abstract
     {
         if ($min instanceof Zend_Config) {
             $min = $min->toArray();
+        }
+
+        if (is_array($min)) {
             if (array_key_exists('min', $min)) {
                 $min = $min['min'];
             } else {

+ 4 - 6
library/Zend/Validate/Iban.php

@@ -113,12 +113,10 @@ class Zend_Validate_Iban extends Zend_Validate_Abstract
     {
         if ($locale instanceof Zend_Config) {
             $locale = $locale->toArray();
-            if (array_key_exists('locale', $locale)) {
-                $locale = $locale['locale'];
-            } else {
-                require_once 'Zend/Validate/Exception.php';
-                throw new Zend_Validate_Exception("Missing option 'locale'");
-            }
+        }
+
+        if (is_array($locale) && array_key_exists('locale', $locale)) {
+            $locale = $locale['locale'];
         }
 
         if ($locale !== null) {

+ 3 - 5
library/Zend/Validate/Int.php

@@ -59,12 +59,10 @@ class Zend_Validate_Int extends Zend_Validate_Abstract
     {
         if ($locale instanceof Zend_Config) {
             $locale = $locale->toArray();
-            if (array_key_exists('locale', $locale)) {
+        }
+
+        if (is_array($locale) && array_key_exists('locale', $locale)) {
                 $locale = $locale['locale'];
-            } else {
-                require_once 'Zend/Validate/Exception.php';
-                throw new Zend_Validate_Exception("Missing option 'locale'");
-            }
         }
 
         if ($locale === null) {

+ 3 - 0
library/Zend/Validate/LessThan.php

@@ -65,6 +65,9 @@ class Zend_Validate_LessThan extends Zend_Validate_Abstract
     {
         if ($max instanceof Zend_Config) {
             $max = $max->toArray();
+        }
+
+        if (is_array($max)) {
             if (array_key_exists('max', $max)) {
                 $max = $max['max'];
             } else {

+ 3 - 0
library/Zend/Validate/Regex.php

@@ -67,6 +67,9 @@ class Zend_Validate_Regex extends Zend_Validate_Abstract
     {
         if ($pattern instanceof Zend_Config) {
             $pattern = $pattern->toArray();
+        }
+
+        if (is_array($pattern)) {
             if (array_key_exists('pattern', $pattern)) {
                 $pattern = $pattern['pattern'];
             } else {