[#3687] imap_append in Message.php fails with no errors
Summary imap_append in Message.php fails with no errors
Queue IMP
Queue Version 4.1
Type Bug
State Resolved
Priority 2. Medium
Owners slusarz@horde.org
Requester david-shafer@uiowa.edu
Created 2006-03-24 (5221 days ago)
Updated 2010-04-23 (3730 days ago)
Assigned 2006-03-25 (5220 days ago)
Resolved 2006-03-28 (5217 days ago)
Patch No

david-shafer@uiowa.edu 2006-03-24 22:54:25
On line 218 of Message.php (v, the call to imap_append() 
was returning false with no errors. I was finally able to resolve the 
problem by changing the imap_append() call to use IMP::serverString() 
(much like the imap_append() call on line 539).

Here is the original version:

/* Save messages in Trash folder. */

foreach ($msg_text as $val) {

if (!@imap_append($imp['stream'], $trash, $val)) {

Here it is after the fix:

$folderstring = IMP::serverString($trash);

/* Save messages in Trash folder. */

foreach ($msg_text as $val) {

if (!@imap_append($imp['stream'], $folderstring, $val)) {

Jan Schneider <jan@horde.org> 2006-03-25 11:54:07
Works perfectly for me without that change.

david-shafer@uiowa.edu 2006-03-25 18:40:53
Thanks for checking it out. I'm sure it works for many people without 
the change, but it definitely wasn't working for us. Using tcpdump 
showed PHP wasn't even attempting the append operation; it returned 
false immediately, as though it didn't like the format of one of the 
parameters. It made sense after I looked at other calls to 
imap_append(). Why wouldn't both calls to imap_append() in Message.php 
use the same calling syntax (with a fully qualified "{server}mailbox" 
rather than just "mailbox")? The sample in the PHP documentation uses 
a fully qualified mailbox as well:


The way it is now, I'm sure it works for many sites, but it definitely 
doesn't work for all. I'm not surprised more people haven't noticed 
it, because this code probably isn't used often. It's only used when 
the trash folder is enabled, and the user's quota prevents them from 
copying a deleted message to the trash, and apparently it's only a 
problem for certain configurations.

Fyi, on the web server we're using php 4.3.9 (the Red Hat Enterprise 
Linux 4 package php-4.3.9-3.9) with c-client 2002e 
(libc-client-2002e-14). The IMAP server is Cyrus 2.2.12 

Michael Slusarz <slusarz@horde.org> 2006-03-28 17:25:45
Fixed in HEAD and 4.1.1.