So I have the following code:
try {
if ($connectionid = ldap_connect($ldapserver)) {
$ldapbindid=ldap_bind($connectionid, $binddn, $bindpw);
if ($mysearch = ldap_search($connectionid, $basedn, $query)) {
//more LDAP code here
}
} else {
return false;
}
} catch (Exception $exception) {
return false;
}
But because I'm supplying the wrong binddn and password, I'm getting a PHP error in the ldap_bind command.
Warning: ldap_bind(): Unable to bind to server: Invalid credentials
But reading my code, I understand I should get a boolean instead?
I have the impression that any errors that happens within the confines of the "try" section is going to be handled by the "catch" section. perhaps I'm understanding try/catch incorrectly?
Thanks a lot