Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.1.5

Bug #4975 Net_LDAP::connect always throws an exception
Submitted: 2005-08-02 21:02 UTC
From: christoph dot rauch at gmail dot com Assigned: delatbabel
Status: Closed Package: Net_LDAP
PHP Version: 5.0.4 OS: Linux
Roadmaps: (Not assigned)    
Subscription  
Comments Add Comment Add patch


Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know! Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem : 45 - 3 = ?

 
 [2005-08-02 21:02 UTC] christoph dot rauch at gmail dot com
Description: ------------ Due to an bug in line 209 in Net_LDAP 1.19.2.10, raiseError always gets called with an exception if the bind fails because of invalid credentials. The new line 209 should be like this or similar return $this->raiseError("Bind failed " . ldap_error($this->_link) ); The ldap_errno has nothing to do with the PEAR error cases. I looked in 1.19.2.11 and this bug has not been fixed yet.

Comments

 [2006-02-06 15:16 UTC] scott at crisscott dot com
I think the real problem here is that the Net_LDAP_Error constructor is missing a message argument which means that when PEAR trys to create the error class, the error code is treated as the error mode. Net_LDAP_Error constructor: function Net_LDAP_Error($code = NET_LDAP_ERROR, $mode = PEAR_ERROR_RETURN, $level = E_USER_NOTICE, $debuginfo = null) PEAR_Error constructor: function PEAR_Error($message = 'unknown error', $code = null, $mode = null, $options = null, $userinfo = null) Notice the missing message argument. When the error class is instantiated, a message is always passed becuase the skipmsg argument (the last argument to raiseError) is never set to true. This message throws the arguments off by one and the error mode on a failed bind becomes 49 instead of 1.
 [2006-02-06 15:23 UTC] scott at crisscott dot com
Possible patch for error message issue: function Net_LDAP_Error(...) { if (is_string($code)) { // A message was given. Drop it and call this // method again. $args = func_get_args(); array_shift($args); return call_user_func_array(array('Net_LDAP_Error', 'Net_LDAP_Error'), $args); } // ... }
 [2006-02-24 01:13 UTC] delatbabel at php dot net
Writing test case for this with PHPUnit.
 [2006-02-24 01:47 UTC] delatbabel at php dot net
This should be fixed by adding the extra parameter back to the Net_LDAP_Error constructor -- this works in my local copy and will be committed back to CVS on the next run.
 [2006-02-24 03:41 UTC] delatbabel 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.