Explorar el Código

[ZF-9246] Zend_File:

- fixed counting

git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@21207 44c647ce-9c0f-0410-b52a-842ac1e357ba
thomas hace 16 años
padre
commit
f8fb4879e0

+ 6 - 2
library/Zend/File/Transfer/Adapter/Abstract.php

@@ -621,6 +621,11 @@ abstract class Zend_File_Transfer_Adapter_Abstract
             if (array_key_exists('validators', $content) &&
                 in_array('Zend_Validate_File_Count', $content['validators'])) {
                 $validator = $this->_validators['Zend_Validate_File_Count'];
+                $count     = $content;
+                if (empty($content['tmp_name'])) {
+                    continue;
+                }
+
                 if (array_key_exists('destination', $content)) {
                     $checkit = $content['destination'];
                 } else {
@@ -628,8 +633,7 @@ abstract class Zend_File_Transfer_Adapter_Abstract
                 }
 
                 $checkit .= DIRECTORY_SEPARATOR . $content['name'];
-                $validator->addFile($checkit);
-                $count = $content;
+                    $validator->addFile($checkit);
             }
         }
 

+ 4 - 1
library/Zend/Validate/File/Count.php

@@ -249,7 +249,10 @@ class Zend_Validate_File_Count extends Zend_Validate_Abstract
             $value = $file['destination'] . DIRECTORY_SEPARATOR . $file['name'];
         }
 
-        $this->addFile($value);
+        if (!empty($file['tmp_name'])) {
+            $this->addFile($value);
+        }
+
         $this->_count = count($this->_files);
         if (($this->_max !== null) && ($this->_count > $this->_max)) {
             return $this->_throw($file, self::TOO_MANY);