No error handling for - ldap_bind(): Unable to bind to server: Invalid credentials.
| From: | Sarno, Giuseppe | Date: | Thu, 24 Jan 2013 20:48:11 +0000 |
| Subject: | No error handling for - ldap_bind(): Unable to bind to server: Invalid credentials. | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-320103@lists.php.net to get a copy of this message | ||
Hello,
I am using php (5.4.11 windows) ldap extension and I am having problems when I bind to my LDAP
server with wrong credentials.
The problem is that I get the warning: : ldap_bind(): Unable to bind to server: Invalid credentials
no matter what I do.
I simply would like to handle the case and gracefully return false in my function (example below).
This problem is preventing me from post processing any PHP logic after bind..
I tried:
1- error_reporting in php.ini (E_ALL & ~E_DEPRECATED & ~E_STRICT & ~E_WARNING &
~E_USER_WARNING & ~E_RECOVERABLE_ERROR & ~E_ERROR or even ~E_ALL)
2- Diplay_errors is Off.
3- Similar setting from code (ini_set etc.)
Can anybody please help ? I have seen many posts on internet but nothing been resolved.
Basic example:
$ds = ldap_connect($address);
if( !$ds ) return false;
ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, 3);
$bind = @ldap_bind($ds,$dn,$password); --> warning.
if( !$bind ) return false;
Thanks,
Giuseppe.
This email and any files transmitted with it are confidential, proprietary
and intended solely for the individual or entity to whom they are addressed.
If you have received this email in error please delete it immediately.