fix for never ending while loop
[squirrelmail.git] / functions / imap_messages.php
index b91d09c78ae41e84eab0c92e8ae37c18f3fa8b0d..f50fdee4a444a4d5c745cde1e8f94aa7c1236733 100755 (executable)
@@ -492,9 +492,9 @@ function sqimap_get_small_header_list ($imap_stream, $msg_list) {
 
         foreach ($read as $read_part) {
             //unfold multi-line headers
-            while ($prevline && strspn($read_part, "\t ") > 0) {
-               $read_part = substr($prevline, 0, -2) . ' ' . ltrim($read_part);
-            }
+           if ($prevline && strpos($read_part, "\t ") === true) {
+               $read_part = substr($prevline, 0, -2) . preg_replace('/(\t\s+)/',' ',$read_part);
+           }
             $prevline = $read_part;
             if ($read_part{0} == '*') {
                 if ($internaldate) {