From 4cef9745b972db61129bde1cc728a02bd3ca7dce Mon Sep 17 00:00:00 2001 From: Michael M Slusarz Date: Wed, 1 Jul 2009 12:25:00 -0600 Subject: [PATCH] Fix multipart size determination --- framework/Mime/lib/Horde/Mime/Part.php | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/framework/Mime/lib/Horde/Mime/Part.php b/framework/Mime/lib/Horde/Mime/Part.php index 6709394b7..41934a5ff 100644 --- a/framework/Mime/lib/Horde/Mime/Part.php +++ b/framework/Mime/lib/Horde/Mime/Part.php @@ -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); -- 2.11.0