6.0.0-beta1
7/5/25

[#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 03/24/2006 (7043 days ago)
Due
Updated 04/23/2010 (5552 days ago)
Assigned 03/25/2006 (7042 days ago)
Resolved 03/28/2006 (7039 days ago)
Github Issue Link
Github Pull Request
Milestone
Patch No

History
03/28/2006 05:25:45 PM Michael Slusarz Comment #4
State ⇒ Resolved
Reply to this comment
Fixed in HEAD and 4.1.1.
03/25/2006 06:40:53 PM 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:



http://www.php.net/manual/en/function.imap-append.php



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 
(cyrus-imapd-2.2.12-3.RHEL4.1).
03/25/2006 11:54:07 AM Jan Schneider Comment #2
Assigned to Michael Slusarz
State ⇒ Feedback
Reply to this comment
Works perfectly for me without that change.
03/24/2006 10:54:25 PM david-shafer (at) uiowa (dot) edu Comment #1
State ⇒ Unconfirmed
Priority ⇒ 2. Medium
Type ⇒ Bug
Summary ⇒ imap_append in Message.php fails with no errors
Queue ⇒ IMP
Reply to this comment
On line 218 of Message.php (v 1.164.8.34), 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