query can be null here - it is in ALL search
authorMichael M Slusarz <slusarz@curecanti.org>
Mon, 26 Apr 2010 21:35:56 +0000 (15:35 -0600)
committerMichael M Slusarz <slusarz@curecanti.org>
Mon, 26 Apr 2010 21:36:36 +0000 (15:36 -0600)
imp/lib/Search.php

index 001185f..3538b0c 100644 (file)
@@ -341,13 +341,15 @@ class IMP_Search
         }
 
         /* Make sure we search in the proper charset. */
-        $new_query = clone $query;
-        $imap_charset = $GLOBALS['imp_imap']->ob()->validSearchCharset('UTF-8')
-            ? 'UTF-8'
-            : 'US-ASCII';
-        $new_query->charset($imap_charset, array('Horde_String', 'convertCharset'));
+        if ($query) {
+            $query = clone $query;
+            $imap_charset = $GLOBALS['imp_imap']->ob()->validSearchCharset('UTF-8')
+                ? 'UTF-8'
+                : 'US-ASCII';
+            $query->charset($imap_charset, array('Horde_String', 'convertCharset'));
+        }
 
-        return $GLOBALS['imp_imap']->ob()->search($mailbox, $new_query, $opts);
+        return $GLOBALS['imp_imap']->ob()->search($mailbox, $query, $opts);
     }
 
     /**