bcosca / fatfree

A powerful yet easy-to-use PHP micro-framework designed to help you build dynamic and robust Web applications - fast!
2.66k stars 446 forks source link

LDAP Login with phhp 8.2 throws Error 500 #1284

Open hartundweich opened 2 weeks ago

hartundweich commented 2 weeks ago

I'm using this framework now since 2019. Today I tried to update php from 7.4 to 8.2 Everything is working except LDAP Authentication. If I put wrong credentials in the login fields I get a Error 500 and throwing "LDAP connection failure" from fatfree Framework. I debugged a little bit and recognized that ldap_bind() in lib/auth.php is throwing an error except returning false.

What can I do to suppress this error 500?

Thanks for your time to give a little hint...

Best Andreas

hartundweich commented 2 weeks ago

I'm a little bit further... Maybe it would be better to split Auth Class LDAP Function in some parts to check if LDAP is configured correctly:

1.) Check if LDAP host can be reached - if not: throw Error 500 2.) Check if given credentials from config work to connect to LDAP host - if not: throw Error 500 3.) Check if given login from login form is working: if not - show error message and return to login form

Point 3 can onyl be achived if we do not run this line in auth.php user_error(self::E_LDAP,E_USER_ERROR);

To solve my problem at the moment I replaced the line above by return false;