Bug #1942 [Fbk->Opn]: wrong parameter-type specification in Net_POP3::login
| From: | swolfsheimer at netz98 dot de | Date: | Mon, 02 Aug 2004 18:23:09 +0000 |
| Subject: | Bug #1942 [Fbk->Opn]: wrong parameter-type specification in Net_POP3::login | ||
| References: | 1 | Groups: | php.pear.doc |
| Request: | Send a blank email to pear-doc+get-4717@lists.php.net to get a copy of this message | ||
Edit report at http://pear.php.net/bugs/bug.php?id=1942&edit=1
ID: 1942
User updated by: swolfsheimer at netz98 dot de
Reported By: swolfsheimer at netz98 dot de
-Status: Feedback
+Status: Open
Type: Bug
Package: Documentation
PHP Version: Irrelevant
New Comment:
in my case neither $apop=true nor $apop=false worked. Only $apop "USER"
was correct.
I am not very familar with the POP3 protocol, so I only can try to
obtain my opion by logical arguments:
the login functions calls _cmdAuthenticat($user,$pass,$apop)
with the critical parameter $apop (see pseudo code below).
From _cmdAuthenticate($uid , $pwd , $userMethod = null first
_getBestAuthMethod($userMethod) is called, and the result ist stored in
$method, followed by a switch, which desides between serval string
statements.
Well, let's have a look how _getBestAuthMethod($userMethod)works in my
case:
Consider the case, that no $this->_capability['sasl'] was found, e.g.
$serverMethods are set to array('APOP','USER').
Now consider, that I want to login with the 'USER'-method, according to
the documentation this would be the boolean value false.
The statement "if($userMethod !== null && $userMethod !== true )" would
be true (because false is not of the same type as null), and false would
be returned by the function. But this causes the default switch in the
_cmdAuthenticate - function, which is an error-handler.
But if $apop would be a string of the value "USER" everything works
fine.
function login($user, $pass, $apop = true)
{
...
$this->_cmdAuthenticate($user , $pass , $apop )
...
}
function _cmdAuthenticate($uid , $pwd , $userMethod = null )
{
...
$method = $this->_getBestAuthMethod($userMethod);
...
switch($method)
{
case 'DIGEST-MD5': ...
case 'CRAM-MD5':
case 'LOGIN':
case 'PLAIN':
case 'APOP':
case 'USER':
default :
ERROR
}
...
}
function _getBestAuthMethod($userMethod = null)
{
...
if( isset($this->_capability['sasl']) ){
$serverMethods=$this->_capability['sasl'];
}else{
$serverMethods=array('APOP','USER');
}
...
if($userMethod !== null && $userMethod !== true )
{
$methods = array();
$methods[] = $userMethod;
return $userMethod;
}
...
}
Previous Comments:
------------------------------------------------------------------------
[2004-07-29 08:27:55] mj at php dot net
After examining the code of Net_POP3, I cannot find any evidence that
the third parameter should be a string. Can you point us to the place
in the code that makes you think so?
Apart from that I've fixed the bogus usage of Net_Ping.
------------------------------------------------------------------------
[2004-07-22 03:50:56] php at cipri dot com
URLS:
http://pear.php.net/manual/en/package.networking.net-pop3.login.php
http://pear.php.net/manual/en/package.networking.net-pop3.php
------------------------------------------------------------------------
[2004-07-21 20:05:29] swolfsheimer at netz98 dot de
Description:
------------
In the PEAR manual following declaration is specified:
boolean Net_POP3::login (string $user string $pass boolean $apop)
Am I right, that the last parameter $apop is not of type boolean, but
of type "boolean or string"? By looking into the source code and
following the parameter over serval function-calls, one can find a
switch (in function _cmdAuthenticate) between the strings 'DIGEST-MD5',
'CRAM-MD5',
'APOP', 'PLAIN' , 'LOGIN', 'USER' or alternativly a false -
value for
this parameter.
following code gives not the result as
expected according to the documentation:
$pop3->login($user, $pass,true);
this would be the correct call:
$pop3->login($user, $pass,"APOP");
Another thing:
Since the last(?) update of the Net_POP3 class-documentation there are
the wrong classnames (Net_Ping instead of Net_POP3) given on the
overview page (
Net_Ping::Net_POP3() and so on)
Reproduce code:
---------------
------------------------------------------------------------------------
--
Edit this bug report at http://pear.php.net/bugs/bug.php?id=1942&edit=1