Fix multipart size determination
authorMichael M Slusarz <slusarz@curecanti.org>
Wed, 1 Jul 2009 18:25:00 +0000 (12:25 -0600)
committerMichael M Slusarz <slusarz@curecanti.org>
Wed, 1 Jul 2009 19:47:43 +0000 (13:47 -0600)
framework/Mime/lib/Horde/Mime/Part.php

index 6709394..41934a5 100644 (file)
@@ -170,7 +170,7 @@ class Horde_Mime_Part
      *
      * @var integer
      */
-    protected $_bytes = 0;
+    protected $_bytes;
 
     /**
      * The content-ID for this part.
@@ -1150,17 +1150,13 @@ class Horde_Mime_Part
      */
     public function getBytes()
     {
-        if (empty($this->_contents)) {
-            $bytes = $this->_bytes ? $this->_bytes : 0;
+        if (isset($this->_bytes)) {
+            $bytes = $this->_bytes;
         } elseif ($this->getPrimaryType() == 'multipart') {
             $bytes = 0;
             reset($this->_parts);
             while (list(,$part) = each($this->_parts)) {
-                /* Skip multipart entries (since this may result in double
-                   counting). */
-                if ($part->getPrimaryType() != 'multipart') {
-                    $bytes += $part->getBytes();
-                }
+                $bytes += $part->getBytes();
             }
         } else {
             fseek($this->_contents, 0, SEEK_END);