Viewing MIME HTML attachments containing style elements with no attributes causes an error in 1.4.22

Abbott <[email protected]> Thu, 1 Sep 2011 17:14:56 -0500
Newsgroups gmane.mail.squirrelmail.devel
Message-ID <[email protected]>
Warning: Variable passed to each() is not an array or object in /usr/local/cpanel/base/3rdparty/squirrelmail/functions/mime.php on line 1594

Message occurs when receiving an attachment something like the following:

Content-Disposition: attachment
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html; charset=utf-8

<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">
<html><head><style><!-- pre { color:red; } --></style></head><body>
<pre><span style="color: #ff0000">Some text.</span></pre>
</body></html>

If the style element has attributes, it seems to work fine.  It only seems to be an issue if a style element has no attributes.  We resolved the issue for our customers using the following patch.

--- squirrelmail-webmail-1.4.22/functions/mime.php	2011-07-11 23:53:11.000000000 -0500
+++ squirrelmail-webmail-1.4.22.cp/functions/mime.php	2011-09-01 16:44:35.000000000 -0500
@@ -1591,6 +1591,10 @@
                     $mailbox
                     ){
     $me = 'sq_fixatts';
+    // cpanel patch (case 52197): mime errors with style tags that have no attributes
+    if (!is_array($attary)){
+        $attary = Array();
+    }
     while (list($attname, $attvalue) = each($attary)){
         /**
          * See if this attribute should be removed.


------------------------------------------------------------------------------
Special Offer -- Download ArcSight Logger for FREE!
Finally, a world-class log management solution at an even better 
price-free! And you'll get a free "Love Thy Logs" t-shirt when you
download Logger. Secure your free ArcSight Logger TODAY!
http://p.sf.net/sfu/arcsisghtdev2dev
-----
squirrelmail-devel mailing list
Posting guidelines: http://squirrelmail.org/postingguidelines
List address: [email protected]
List archives: http://news.gmane.org/gmane.mail.squirrelmail.devel
List info (subscribe/unsubscribe/change options): https://lists.sourceforge.net/lists/listinfo/squirrelmail-devel