ltb-project / service-desk

Application for support team who need to check and reset user passwords
https://service-desk.readthedocs.io/
GNU General Public License v3.0
51 stars 21 forks source link

Fatal error when wrong base DN configured #184

Closed coudot closed 4 days ago

coudot commented 1 week ago

If user base DN is not correct in configuration, we get a fatal error:

PHP message: PHP Warning:  ldap_search(): Search: No such object in /usr/local/service-desk/vendor/ltb-project/ltb-common/src/Ltb/PhpLDAP.php on line 56; PHP message: PHP Fatal error:  Uncaught TypeError: ldap_parse_result(): Argument #2 ($result) must be of type LDAP\\Result, false given in /usr/local/service-desk/vendor/ltb-project/ltb-common/src/Ltb/PhpLDAP.php:96\nStack trace:\n#0 /usr/local/service-desk/vendor/ltb-project/ltb-common/src/Ltb/PhpLDAP.php(96): ldap_parse_result()\n#1 /usr/local/service-desk/vendor/ltb-project/ltb-common/src/Ltb/Ldap.php(159): Ltb\\PhpLDAP::ldap_parse_result()\n#2 /usr/local/service-desk/htdocs/search.php(32): Ltb\\Ldap->search()\n#3 /usr/local/service-desk/htdocs/index.php(270): require_once('...')\n#4 {main}\n  thrown in /usr/local/service-desk/vendor/ltb-project/ltb-common/src/Ltb/PhpLDAP.php on line 96', referer: https://sd.example.com/index.php?page=welcome

We should catch the error.

davidcoutadeur commented 4 days ago

Done in https://github.com/ltb-project/ltb-common/issues/54