|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #51708 imap_open() improperly trimming spaces from username
Submitted: 2010-04-30 21:05 UTC Modified: 2010-05-03 15:34 UTC
From: slusarz at curecanti dot org Assigned:
Status: Not a bug Package: IMAP related
PHP Version: 5.3.2 OS: Linux
Private report: No CVE-ID: None
 [2010-04-30 21:05 UTC] slusarz at curecanti dot org
Per RFC 3501 [9], spaces are valid characters in a username.  Thus, 'username' != ' username '.  However, imap_open() appears to be stripping leading/trailing whitespace from the username.

Test script:

$mailbox = '{localhost:143}INBOX';
// 'username' is valid user; ' username ' is invalid user
$username = ' username ';
$password = 'password';

$res = imap_open($mailbox, $username, $password, OP_HALFOPEN);

if (is_resource($res)) {
    print "SUCCESS\n";
} else {
    print "FAILED\n";

Expected result:

Actual result:


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2010-05-03 15:34 UTC]
-Status: Open +Status: Bogus
 [2010-05-03 15:34 UTC]
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit as this bug system is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.

The trimming (if it happens) is done by c-client lib, not PHP.
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Sun Sep 25 07:05:51 2022 UTC