php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #9488 Imap connection silently fails.
Submitted: 2001-02-27 17:09 UTC Modified: 2001-02-27 17:27 UTC
From: jlhaase at iland dot net Assigned:
Status: Closed Package: IMAP related
PHP Version: 4.0.4pl1 OS: Redhat Linux 6.2 & above
Private report: No CVE-ID: None
 [2001-02-27 17:09 UTC] jlhaase at iland dot net
This problem is similar to that I submitted in bug # 7816,
however it expands on it.  

It appears that the imap_open function fails silently if you
have used any other socket-type function previously in the
script.  Specifically I have seen this with calls to
fsockopen, and also the mysql_connect functions.  In a
script that I have written I was trying to athenticate the
user before calling the imap_open function, because the
imap_open function takes so long to fail when given an
incorrect username-password pair.  Origanally I was trying
to authenticate to a mysql radius database for
authentication, however when the imap function refused to
work with mysql_connect called prior to it, I tried using
fsockopen to connect to the pop3 port on the server so that
I could manually attemp authentication.  However this
produced the same results as the mysql attempt.  

Specifically I am calling a function for imap_open in the
following manner...

$mbox = imap_open("{my.mail.server:143}" . $mailbox,
$username, $password)  || die ("can't connect: " .
imap_last_error());

This works fine unless I have call fsockopen or
mysql_connect before this.  If you use either of those
functions prior to this statement in the php script however
the imap_open function appears to succeed and a value is
assigned to $mbox, however subsequent calls to imap
functions attempting to use the "imap stream" stored in
$mbox will fail with an error stating that $mbox is not a
valid imap stream.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-02-27 17:27 UTC] sniper@php.net
Change the '||' to 'or'  and it should work ok.

--Jani



 
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Sat Nov 26 19:05:53 2022 UTC