[#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 (at) horde (dot) org
Requester david-shafer (at) uiowa (dot) edu
Created 2006-03-24 (5420 days ago)
Updated 2010-04-23 (3929 days ago)
Assigned 2006-03-25 (5419 days ago)
Resolved 2006-03-28 (5416 days ago)
Patch No

2006-03-28 17:25:45 Michael Slusarz Comment #4
State ⇒ Resolved
Reply to this comment
Fixed in HEAD and 4.1.1.
2006-03-25 18:40:53 david-shafer (at) uiowa (dot) edu Comment #3 Reply to this comment
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 
2006-03-25 11:54:07 Jan Schneider Comment #2
Assigned to Michael Slusarz
State ⇒ Feedback
Reply to this comment
Works perfectly for me without that change.
2006-03-24 22:54:25 david-shafer (at) uiowa (dot) edu Comment #1
Type ⇒ Bug
State ⇒ Unconfirmed
Priority ⇒ 2. Medium
Summary ⇒ imap_append in Message.php fails with no errors
Queue ⇒ IMP
Reply to this comment
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)) {

Saved Queries