PEAR is discontinued

This is a static archive preserving historical releases and metadata. No new packages or updates will be published. For updates to existing packages, or to publish new packages, please use Composer and Packagist.

Home » Authentication » Auth » Bug #1401

IMAP authentication fails due to error in code

Details

Submitted2004-05-13 16:47 UTC
Frommail at andreas dot id dot au
Assignedyavo
StatusClosed
PackageAuth
PHP Version5.0.0RC2 (Release Candidate 2)
OSFreeBSD
Roadmaps(Not assigned)

Comments

[2004-05-13 16:47 UTC] mail at andreas dot id dot au

Description:
------------
The IMAP authentication is always saying that it is unable to connect to server.

There is a typing error in the code, $timeout should read $this->options['timeout']. Due to $timeout having a 0 value the fsockopen function gives up right away and returns false.

Reproduce code:
---------------
function _checkServer() {
$fp = @fsockopen ($this->options['host'], $this->options['port'],
$errno, $errstr, $timeout);
if (is_resource($fp)) {
@fclose($fp);
} else {
$message = "Error connecting to IMAP server "
. $this->options['host']
. ":" . $this->options['port'];
return PEAR::raiseError($message, 41, PEAR_ERROR_DIE);
}
}

[2004-05-16 01:17 UTC] mail at andreas dot id dot au

I have downloaded 1.2.3 from the PEAR website and have confirmed that the bug still exists in this version.

$fp = @fsockopen ($this->options['host'], $this->options['port'],
$errno, $errstr, $timeout);

That is the line of code copied out of IMAP.php, line 124 and 125. $timeout needs to be $this->options['timeout'].

Can you please check your CVS and verify that the latest version of that file has this fixed.