6.0.0-alpha12
6/7/25

[#5012] wrong trash folder options check in Message.php delete()
Summary wrong trash folder options check in Message.php delete()
Queue IMP
Queue Version 4.1.3
Type Bug
State Resolved
Priority 1. Low
Owners chuck (at) horde (dot) org, slusarz (at) horde (dot) org
Requester stephan (at) stean (dot) ch
Created 02/19/2007 (6683 days ago)
Due
Updated 03/01/2007 (6673 days ago)
Assigned 02/28/2007 (6674 days ago)
Resolved 03/01/2007 (6673 days ago)
Github Issue Link
Github Pull Request
Milestone
Patch No

History
03/01/2007 07:19:58 AM Michael Slusarz Comment #5
State ⇒ Resolved
Reply to this comment
Makes sense to only allow move to trash if a trash folder is defined.   
Fixed in HEAD and 4.1.4:

http://lists.horde.org/archives/cvs/Week-of-Mon-20070226/065652.html
02/28/2007 06:29:02 PM Jan Schneider Comment #4
Assigned to Chuck Hagenbuch
Assigned to Michael Slusarz
State ⇒ Assigned
Reply to this comment
I'm really not sure, I can see both actions being the right one. 
Michael, Chuck, what do you think?
02/24/2007 07:55:46 AM stephan (at) stean (dot) ch Comment #3 Reply to this comment
No, $prefs->getValue('trash_folder') will return the default value
from config/prefs.php when the user hasn't set a folder yet, and if
you haven't broken your system.
I thought about having broken something too. But found nothing, and all the

other settings from prefs.php where readable. So I made a test with a vanilla

installation, with minor changes in servers.php. And came to the same results.



Here what happens:



Mail options "Deleting and Moving messages", I enable the "When 
deleting messages, move..."

option. But dont choose a trash folder from the list. IMP will insert 
an empty trash_folder into the

horde_prefs table.



However, if I enable the very same option, choose "Create a new 
trashfolder", instead of entering

the name press the cancel button, it works. IMP wont insert the empty 
trash_folder into the

horde_prefs table and uses the prefs.php setting.



And of course if giving a name for the trash folder when asked for, 
instead of pressing cancel,

that one will be used by IMP.



So, the problem is quite somewhere else, namely in the page processing 
of the IMP options.

imp/lib/prefs.php  function handlefolders($updated, $pref, $folder, 
$new) does the following:

             if ($folder == IMP_PREF_NO_FOLDER) {

                 $prefs->setValue($pref, '');

             } else {

I think when a user chooses to move deleted messages to a trash folder 
this code fragment

does the wrong job. It should do as in the else part that follows, 
choose an appropriate trash

folder name and use it.



Thats the way I think about it.
02/21/2007 11:57:56 PM Jan Schneider Comment #2
State ⇒ Feedback
Reply to this comment
No, $prefs->getValue('trash_folder') will return the default value 
from config/prefs.php when the user hasn't set a folder yet, and if 
you haven't broken your system.
02/19/2007 06:57:07 PM stephan (at) stean (dot) ch Comment #1
Priority ⇒ 1. Low
Type ⇒ Bug
Summary ⇒ wrong trash folder options check in Message.php delete()
Queue ⇒ IMP
State ⇒ Unconfirmed
Reply to this comment
The following line will return a wrong result

if the user forgot to set the trash folder in

the IMP options:



$trash = IMP::folderPref($prefs->getValue('trash_folder'), true);



$prefs->getValue('trash_folder')

returns nothing, however folderPref will prepend INBOX,

thus the trash folder will be INBOX, The following check

will not fail, however should:



...

$use_trash = $prefs->getValue('use_trash');

         if ($use_trash && !$trash) {

...



and @imap_mail_move will report an error.

Saved Queries