[dev] [PATCH][IMP] folder rename $all_folders fix

Alvaro Figueroa Cabezas fede2 at fuerzag.ulatina.ac.cr
Thu Feb 12 13:57:21 PST 2004


This fix is for imp/lib/Folders.php.

Due to a missing check to see if imap_list is really returning data on
the array[1], the foreach cicle is doing another pass with invalid data
on $folder_old. The result is that it is renaming the folder as asked,
but it is also printing (trough $notification->push 'horde.error', on
the extra cicle): Renaming "" to "" failed. This is what the server
said: Can't rename mailbox : no such mailbox.

[1] Actually, php's manual for imap_list does this same check on the
example. Please check php.net/manual/en/function.imap-list.php if
interested.

-- 
Alvaro Figueroa

-------------- next part --------------
Index: Folder.php
===================================================================
RCS file: /repository/imp/lib/Folder.php,v
retrieving revision 1.112
diff -u -r1.112 Folder.php
--- Folder.php	9 Feb 2004 19:38:07 -0000	1.112
+++ Folder.php	12 Feb 2004 21:55:45 -0000
@@ -489,10 +489,15 @@
         global $conf, $imp, $notification;
 
         $server = IMP::serverString();
+        $folder_list = imap_list($stream, $server, $old . $imp['delimiter'] . '*');
         $success = true;
 
         /* Get list of any folders that are underneath this one. */
-        $all_folders = array_merge(array($server . $old), imap_list($stream, $server, $old . $imp['delimiter'] . '*'));
+        if (is_array($folder_list)) {
+            $all_folders = array_merge(array($server . $old), $folder_list);
+        } else {
+            $all_folders = array($server . $old);
+        }
 
         /* Get subscribed status. */
         $subscribed_folders = @imap_lsub($stream, $server, $old . '*');


More information about the dev mailing list