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 » Networking » Net_IMAP » Bug #1280

Net_IMAP::connect() always returns a pear error

Details

Submitted2004-04-25 15:37 UTC
Frompear at oak-wood dot co dot uk
Assigneddamian
StatusClosed
PackageNet_IMAP
PHP Version4.3.2
OSFreeBSD 5.1
Roadmaps(Not assigned)

Comments

[2004-04-25 15:37 UTC] pear at oak-wood dot co dot uk

Description:
------------
Using 0.7.1

Net_IMAP::connect() tests for a particular value in an array
returned by cmdConnect(), but cmdConnect() does not return an array! It returns true on success and a PEAR error on failure.

The result is that Net_IMAP::connect() always returns a PEAR error, even when it is successful.

It appears that this may also apply to the constructor method.

This fixes it, but I'm sure it could be improved on:

--- IMAP.php.orig Sat Apr 24 12:24:37 2004
+++ IMAP.php Sun Apr 25 10:05:20 2004
@@ -70,8 +70,8 @@
function connect($host, $port)
{
$ret=$this->cmdConnect($host,$port);
- if(strtoupper($ret["RESPONSE"]["CODE"]) != "OK"){
- return new PEAR_Error($ret["RESPONSE"]["CODE"] . ", " . $ret["RESPONSE"]["STR_CODE"]);
+ if(empty($ret)){
+ return new PEAR_Error("Unexpected response on connection");
}
return $ret;
}