I’m using the LDAP functions in PHP.
My code works quite well, but a problem arises when the user types the wrong password.
In that case my expectation is a message that says “wrong password inserted” (I created a function for it) but instead of it PHP returns an error that blocks the script execution.
Warning: ldap_bind(): Unable to bind to server: Invalid credentials in
/var/www/html/0functions/logon.php on line 83Warning: ldap_search(): Search: Operations error in
/var/www/html/0functions/logon.php on line 85Fatal error: Uncaught TypeError: ldap_get_entries(): Argument #2
($result) must be of type LDAPResult, false given in
/var/www/html/0functions/logon.php:86 Stack trace: #0
/var/www/html/0functions/logon.php(86):
ldap_get_entries(Object(LDAPConnection), false) #1
/var/www/html/login.php(22): logdap(‘USER’, ‘PWD’) #2 {main} thrown in
/var/www/html/0functions/logon.php on line 86
My perception is that this is a DLL error. Is there a way to get around this error and let my function go to the end?
It is annoying for the user because they receive the error 500 and get stuck without understanding that it is just because the password is wrong.