Permalink
Browse files

fix declaration of net_ldap_error

fixes the problem of pear throwing exception when bind fails


git-svn-id: http://svn.php.net/repository/pear/packages/Net_LDAP/branches/NET_LDAP_0_6@196024 c90b9560-bf6c-de11-be94-00142212c4b1
  • Loading branch information...
1 parent b6d8bb0 commit 90ed689c70672716dccb43d570a311e9538f441e Jan Wagner committed Sep 14, 2005
Showing with 17 additions and 5 deletions.
  1. +17 −5 LDAP.php
View
@@ -1044,20 +1044,32 @@ class Net_LDAP_Error extends PEAR_Error
/**
* Net_LDAP_Error constructor.
*
+ * @param string Error message
* @param mixed Net_LDAP error code, or string with error message.
* @param integer what "error mode" to operate in
* @param integer what error level to use for $mode & PEAR_ERROR_TRIGGER
* @param mixed additional debug info, such as the last query
* @access public
* @see PEAR_Error
*/
- function Net_LDAP_Error($code = NET_LDAP_ERROR, $mode = PEAR_ERROR_RETURN,
- $level = E_USER_NOTICE, $debuginfo = null)
+ function Net_LDAP_Error($msg = 'unknown error',
+ $code = NET_LDAP_ERROR,
+ $mode = PEAR_ERROR_RETURN,
+ $level = E_USER_NOTICE,
+ $debuginfo = null)
{
- if (is_int($code)) {
- $this->PEAR_Error('Net_LDAP_Error: ' . Net_LDAP::errorMessage($code), $code, $mode, $level, $debuginfo);
+ if (is_int($msg)) {
+ $this->PEAR_Error('Net_LDAP_Error: ' . Net_LDAP::errorMessage($msg),
+ $msg,
+ $mode,
+ $level,
+ $debuginfo);
} else {
- $this->PEAR_Error("Net_LDAP_Error: $code", NET_LDAP_ERROR, $mode, $level, $debuginfo);
+ $this->PEAR_Error("Net_LDAP_Error: $msg",
+ NET_LDAP_ERROR,
+ $mode,
+ $level,
+ $debuginfo);
}
}
}

0 comments on commit 90ed689

Please sign in to comment.