php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #14435 imap_status fails if multiple imap connections made
Submitted: 2001-12-11 15:30 UTC Modified: 2001-12-13 23:03 UTC
From: rdp at talisman dot mv dot com Assigned:
Status: Closed Package: IMAP related
PHP Version: 4.1.0 OS: Linux (RH7.2, 2.4.9-7)
Private report: No CVE-ID: None
 [2001-12-11 15:30 UTC] rdp at talisman dot mv dot com
If I open multiple imap connections to different servers I can not use imap_status on the first server opened, but other imap calls (example: imap_mailboxmsginfo) will work. This seems similar to bug 8424, but involving multiple servers.

Code example:
<?
	$conn1 = imap_open("{host1:143}INBOX","user1","password1");
	var_dump($conn1);
	$status1 = imap_status($conn1,"{host1:143}INBOX",SA_ALL);
	var_dump($status1);

	$conn2 = imap_open("{host2:143}INBOX","user2","password2");
        var_dump($conn2);
        $status2 = imap_status($conn2,"{host2:143}INBOX",SA_ALL);
        var_dump($status2);

	$status1 = imap_status($conn1,"{host1:143}INBOX",SA_ALL);
        var_dump($status1);

	$info1 = imap_mailboxmsginfo($conn1);
	var_dump($info1);

	imap_close ($conn1);
	imap_close ($conn2);
?>

The results from running this against two different servers (with different user IDs and passwords) are:

resource(1) of type (imap)
object(stdClass)(6) {
  ["flags"]=>
  int(31)
  ["messages"]=>
  int(2)
  ["recent"]=>
  int(0)
  ["unseen"]=>
  int(0)
  ["uidnext"]=>
  int(3)
  ["uidvalidity"]=>
  int(1008100790)
}
resource(2) of type (imap)
object(stdClass)(6) {
  ["flags"]=>
  int(31)
  ["messages"]=>
  int(9)
  ["recent"]=>
  int(0)
  ["unseen"]=>
  int(1)
  ["uidnext"]=>
  int(56694)
  ["uidvalidity"]=>
  int(407)
}
bool(false)
object(stdClass)(8) {
  ["Unread"]=>
  int(0)
  ["Deleted"]=>
  int(0)
  ["Nmsgs"]=>
  int(2)
  ["Size"]=>
  int(4974)
  ["Date"]=>
  string(37) "Tue, 11 Dec 2001 15:20:52 -0500 (EST)"
  ["Driver"]=>
  string(4) "imap"
  ["Mailbox"]=>
  string(49) "{localhost.localdomain:143/imap/user="user"}INBOX"
  ["Recent"]=>
  int(0)

Note the bool(false) return from the second imap_status
call against host1, though I never closed the imap_connection and the imap_mailboxmsginfo call below works fine.

I can see errors in the systems logs being generated by this script. It seems that imap_status is getting the host correct but is passing the wrong userid to the imap server.

So for example in the above I see errors from imapd on
host1 using the username from host2.

(FWIW I also seen this behavior with the 4.2.0-dev tree from November 28th, 2001).

--rdp

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-12-12 11:25 UTC] sniper@php.net
What version of c-client you have compiled PHP with?
Does this work with older PHP versions?

 [2001-12-12 14:30 UTC] rdp at talisman dot mv dot com
This is from RedHat 7.2 i386, so the imap version is
imap-2000c-15. I also have a debian unstable machine and I'll see if it behaves the same on there.
 [2001-12-13 12:14 UTC] rdp at talisman dot mv dot com
This looks to be a bug in either imap2000 or RedHat's 
imap2000 packages. It's fails with both php 4.1.0 and 4.0.6 on RH 7.2 and 7.0. However after updating the 7.2 machine to imap2001 (from rawhide) and recompiling 4.1.0 it all seems to work. Also my Debian unstable machine (with imap2001) seems to be fine as well.

Sorry to waste your time.
 [2001-12-13 23:03 UTC] sniper@php.net
Closing this then.

--Jani

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Nov 06 17:01:48 2024 UTC