PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » Networking » Net_IMAP » Bug #9304

disconnect bug

Details

Submitted2006-11-11 03:45 UTC
Fromc00lways at gmail dot com
Assignedamistry
StatusClosed
PackageNet_IMAP
PHP Version5.1.4
OSwindows xp professional
Roadmaps(Not assigned)

Comments

[2006-11-11 03:45 UTC] c00lways at gmail dot com

Description:
------------
in Net/IMAP.php

the function disconnect actually return "String" on success.
but your code seems to use php_error functions without checking on the value received from cmdLogout() command.

i've added this code right before return true in function disconnect( ... )

if( get_class( $ret ) == "PEAR_Error" )
{
if(strtoupper($ret["RESPONSE"]["CODE"]) != "OK"){
return new PEAR_Error($ret["RESPONSE"]["CODE"] . ", " . $ret["RESPONSE"]["STR_CODE"]);
}
}

return true;

Test script:
---------------
full ammended disconnect function:

function disconnect($expungeOnExit = false)
{
if($expungeOnExit){
$ret=$this->cmdExpunge();
if(strtoupper($ret["RESPONSE"]["CODE"]) != "OK"){
$ret=$this->cmdLogout();
return new PEAR_Error($ret["RESPONSE"]["CODE"] . ", " . $ret["RESPONSE"]["STR_CODE"]);
}
}
$ret=$this->cmdLogout();

if( get_class( $ret ) == "PEAR_Error" )
{
if(strtoupper($ret["RESPONSE"]["CODE"]) != "OK"){
return new PEAR_Error($ret["RESPONSE"]["CODE"] . ", " . $ret["RESPONSE"]["STR_CODE"]);
}
}

return true;
}

[2006-12-11 15:55 UTC] amistry at php dot net

This should be fixed in the CVS. Please verify.

[2006-12-11 21:20 UTC] hudeldudel at php dot net

Hi Anish,

this bug is not fixed in cvs!
At cmdLogout:
$this->_genericCommand( 'LOGOUT' )
returns no parsed response but
"* BYE LOGOUT received" which is of course a string.

I need to have a closer look at _genericImapResponseParser() where I think the problem is located.

[2006-12-11 21:29 UTC] hudeldudel at php dot net

This bug has been fixed in CVS.

If this was a documentation problem, the fix will appear on pear.php.net by the end of next Sunday (CET).

If this was a problem with the pear.php.net website, the change should be live shortly.

Otherwise, the fix will appear in the package's next release.

Thank you for the report and for helping us make PEAR better.

My failure. Tested against wrong IMAPProtokol.php

Fixed in CVS.