#1971 Error when sending new mails after Upgrading to PHP 5.1.0



after upgrading from PHP 5.0.3 to PHP 5.1.0 my
Squirrelmail ( Version 1.4.4 ) didn't work properly.
Before the upgrade, everything worked fine.

I also checked this with Squirrelmail 1.5.0 and the
latest CVS version (checked out 26.11.05 14:47).

Webserver is Apache 2.0.46 running on Red Hat ES 3.
Imap is IMAP4rev1 2003.338rh.

Error description:

After composing a message and pressing "Send" button, I
got the error message

"ERROR: Bad or malformed request.
Server responded: Missing message to APPEND "

Taking a look to the maillog, it says:

"Nov 26 14:43:45 ds80-237-219-194 imapd[10434]:
Command stream end of file, while reading line
user=cszardenings host=localhost.localdomain []"

The message IS sent by postfix, but due to the error
SquirrelMail doesn't save it in "SENT" folder.

I guess it has something to do with the new php5.1.0
stuff? But I guess it's a goog idea to have
squirrelmail compatible with php5.1.0 ?



  • Logged In: YES

    Ok. I debugged squirrelmail a little, and I found out, that
    the error occurs when sending the APPEND Command to IMAP.

    I found the error in /functions/imap_general.php line 891:

    Reason: The following command is sent to imap when trying to
    append the sent message to "Sent" folder:

    A004 APPEND "Sent" (\Seen) {$length}

    The $length value is not parsed / replaced by php. So I
    changed line 891 from

    fputs ($imap_stream, sqimap_session_id() . " APPEND
    \"$sent_folder\" (\\Seen) \{$length}\r\n");


    fputs ($imap_stream, sqimap_session_id() . " APPEND
    \"$sent_folder\" (\\Seen) {" . $length . "}\r\n");

    and everything works now.

    Kind regards
    Christian Szardenings

  • Tomas Kuliavas
    Tomas Kuliavas

    • assigned_to: nobody --> tokul
  • Tomas Kuliavas
    Tomas Kuliavas

    Logged In: YES

    Issue is fixed in 1.5.1cvs functions/imap_general.php
    v.1.205 and 1.4.6cvs functions/imap_general.php v.

    Keeping tracker open in order to prevent duplicate bug reports.

  • Tomas Kuliavas
    Tomas Kuliavas

    • status: open --> open-fixed
  • Logged In: NO

    I am having the same problem! (ron at ronware dot org)

  • Logged In: NO

    Also same problem here.. Running 1.4.6 CVS

  • Logged In: YES

    It's a PHP bug, you should upgrade to PHP 5.1.1.

  • Tomas Kuliavas
    Tomas Kuliavas

    Logged In: YES

    Do you have php bug number?

    sqimap_append() function did not follow php manual.


    curlies are not listed in table of escaped characters.

  • Logged In: YES

    Tokul, you're right, the PHP documentation says that 5.1.0's
    behaviour was the expected, yet they removed it in 5.1.1 anyway.

    So I guess you should leave it in CVS as it is. Then it'll
    work on 5.1.1 and maybe in future versions (when PHP changes
    its behaviour again to become compliant with the

  • Logged In: NO

    Hate to be stop the party, but with 1.4.6 CVS and PHP 5.1.1
    or Latest PHP 5 CVS verison i still am unable to sent
    emails. The emails are send but not stored into the SENT folder.

    E_NOTICE gave me this

    PHP Notice: Object of class ContentType could not be
    converted to int in /sm/class/mime/Rfc822Header.class.php on
    line 61

    So whats up next.

  • Logged In: NO

    Indeed, after sending you receive :

    ERROR: Bad or malformed request.
    Server responded: Missing literal in APPEND

  • Logged In: YES

    What the hell.... I've currently installed PHP 5.1.1, and
    now, PHP interprets the \{$length} stuff as

    A004 APPEND "INBOX.Sent" (\Seen) \{514}

    So, now it's the backslash that makes the thing go wrong.
    Nevertheless.... the latest CVS snapshot works fine for me
    with PHP 5.1.1

  • Logged In: NO

    ** UPDATE **

    I had an 1.4.6 CVS from october 2005 installed and installed
    the latetst one (1130).

    This one worked!

    So it is indeed an PHP 5.1.0 issue and not an squirrelmail
    issue, besides the fact there has been an since in a month
    time regarding this issue in SM also :)

    Glad that it worked, after a day of pain :(

  • Tomas Kuliavas
    Tomas Kuliavas

    Logged In: YES

    Re "PHP Notice: Object of class ContentType could not be
    converted to int in /sm/class/mime/Rfc822Header.class.php on
    line 61"

    Update your 1.4.6cvs copy. This issue was fixed in same cvs
    commit on 2005-11-27. class/mime/Rfc822Header.class.php
    v. (1.4.6cvs) and v.1.52 (1.5.1cvs) does not
    display this notice. You can find version numbers in php
    file header.

    Please name your SquirrelMail version before reporting bugs
    E_NOTICE errors in some line of code. Or at least show $Id:$
    string of affected file and make sure that you can reproduce
    it in latest stable CVS snapshot.

  • Logged In: NO

    With the latest CVS of Squirrelmail 1.4.6 and the latest
    stable version of PHP, I am still getting this error.

  • Tomas Kuliavas
    Tomas Kuliavas

    Logged In: YES

    Re: "I am still getting this error"

    Could you be more specific? There are two anonymous error
    reports with different error messages. Please provide
    identification strings from your
    class/mime/Rfc822Header.class.php and
    functions/imap_general.php files.

  • Tomas Kuliavas
    Tomas Kuliavas

    • status: open-fixed --> closed-fixed
  • Tomas Kuliavas
    Tomas Kuliavas

    Logged In: YES

    1.4.6rc1 released. Closing bug report. If you have other
    problems related to php 5.1+, file other bug report with
    information that allows to reproduce it in standard php 5.1+
    or 5.1-dev snapshot installation.

  • Logged In: NO

    Try increasing PHP memory_limit to more than 8mb. Wasn't
    able to send email when account exceeded 1000 emails.

  • Logged In: NO

    Hi I get this message when I'm trying to delete the message
    on my INBOX.

    Error Message:
    ERROR : Could not complete request.
    Query: COPY 70:70 "INBOX.Trash"
    Reason Given: [ALERT] COPY failed - no write permission or
    out of disk space.