Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LDAP Plugin - PHP 8 compatibility #567

Open
Rowlett opened this issue Jul 7, 2023 · 9 comments
Open

LDAP Plugin - PHP 8 compatibility #567

Rowlett opened this issue Jul 7, 2023 · 9 comments
Assignees
Milestone

Comments

@Rowlett
Copy link
Contributor

Rowlett commented Jul 7, 2023

LDAP Plugin currently not working with PHP 8.

Steps to reproduce the behavior:
Upgrade PHP to PHP 8.x

LDAP just provide authentication via AD.

  • FOG version: latest dev code
  • OS: Debian 12
@Neustradamus
Copy link

@Sebastian-Roth: Have you seen this ticket?

@Sebastian-Roth
Copy link
Member

Sebastian-Roth commented Jul 20, 2023 via email

@tomamplius
Copy link

tomamplius commented Jul 28, 2023

I have issue with PHP8.2

[Fri Jul 28 22:58:35.509195 2023] [proxy_fcgi:error] [pid 147938] [client 10.xx.xx.xx:36044] AH01071: Got error 'PHP message: PHP Fatal error:  Uncaught TypeError: ldap_unbind(): Argument #1 ($ldap) must be of type LDAP\\Connection, null given in /var/www/html/fog/lib/plugins/ldap/class/ldap.class.php:124\nStack trace:\n#0 /var/www/html/fog/lib/plugins/ldap/class/ldap.class.php(124): ldap_unbind()\n#1 /var/www/html/fog/lib/plugins/ldap/class/ldap.class.php(235): LDAP->__call()\n#2 /var/www/html/fog/lib/plugins/ldap/hooks/ldappluginhook.hook.php(126): LDAP->authLDAP()\n#3 /var/www/html/fog/lib/fog/hookmanager.class.php(86): LDAPPluginHook->checkAddUser()\n#4 /var/www/html/fog/lib/fog/user.class.php(139): HookManager->processEvent()\n#5 /var/www/html/fog/lib/fog/user.class.php(226): User->passwordValidate()\n#6 /var/www/html/fog/lib/fog/fogbase.class.php(2469): User->validatePw()\n#7 /var/www/html/fog/lib/pages/processlogin.class.php(151): FOGBase::attemptLogin()\n#8 /var/www/html/fog/management/index.php(31): ProcessLogin->processMainLogin()\n#9 {main}\n  thrown in /var/www/html/fog/lib/plugins/ldap/class/ldap.class.php o...', referer: http://fog.leolagrange-gestion.org/fog/management/index.php

I have add bellow code and all work after

    try {
                @$this->unbind();
    } catch (TypeError $e) {
    }

@Sebastian-Roth
Copy link
Member

@Rowlett @tomamplius Can you guys please pull the lates dev-branch to test and report back?

@imgurbot12
Copy link

imgurbot12 commented Aug 29, 2023

@Sebastian-Roth
I've updated and ran a test and came across a secondary error when trying to login over ldap using the FOG live boot on a workstation to deploy an image:

PHP message: PHP Fatal error:  Uncaught Error: LDAP connection has already been closed in /var/www/html/fog/lib/plugins/ldap/class/ldap.class.php:124\nStack trace:\n#0 /var/www/html/fog/lib/plugins/ldap/class/ldap.class.php(124): ldap_unbind()

I also noticed a quirk when logging in on the web-portal. If you press Enter to complete the login, the LDAP component is never triggered, but if you click the Login button it works which is quite confusing lol.

@imgurbot12
Copy link

I've managed to make it work by just avoiding the error altogether, but I'm not sure if this is the best way to handle things:

        try {
            $this->unbind();
        } catch (TypeError $e) {
        } catch (Throwable $e) {}

@Sebastian-Roth
Copy link
Member

@imgurbot12 Thanks for bringing this up. I guess ignoring all errors on unbind is not great but still fine.

@tomamplius Would you be able to send in another PR?

@tomamplius
Copy link

#573 thank you

@imgurbot12
Copy link

I also noticed a quirk when logging in on the web-portal. If you press Enter to complete the login, the LDAP component is never triggered, but if you click the Login button it works which is quite confusing lol.

Is there any way to potentially solve this problem as well? I have no idea what would be causing the behavior difference but it does make it a little inconvenient when logging in

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants