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 -> An unexpected failure occurred #317

Closed
Elendil4 opened this issue Jan 21, 2023 · 2 comments · Fixed by #333
Closed

LDAP -> An unexpected failure occurred #317

Elendil4 opened this issue Jan 21, 2023 · 2 comments · Fixed by #333

Comments

@Elendil4
Copy link

Hello,

I am new to the zf1-future world. Does anyone have LDAP running successfully? After migrating from 1.12 to shardj and PHP8.1 it is no longer possible to connect.

In Ldap.php, is_resource($resource) does not return true.

$resource = ($useUri) ? @ldap_connect($this->_connectString) : @ldap_connect($host, $port);

if (is_resource($resource) === true) {
}

Parameters are

ldap.server1.host = 192.168.1.2
ldap.server1.accountDomainName = xxx.local
ldap.server1.accountDomainNameShort = xxx
ldap.server1.accountCanonicalForm = 3
ldap.server1.baseDn = "OU=yyy,DC=xxx,DC=local"
ldap.server1.useStartTls = false
ldap.server1.port = 389

error

    array (size=6)
      0 => string 'An unexpected failure occurred' (length=30)
      1 => string 'Failed to connect to LDAP server: 192.168.1.2:389' (length=51)
      2 => string 'host=192.168.2.2,accountDomainName=xxx.local,accountDomainNameShort=xxx,accountCanonicalForm=3,baseDn=OU=yyy,DC=xxx,DC=local,useStartTls=,port=389' (length=176)
      3 => string '/var/www/vendor/shardj/zf1-future/library/Zend/Ldap.php(814): Failed to connect to LDAP server: 192.168.1.2:389' (length=127)
      4 => string '#0 /var/www/vendor/shardj/zf1-future/library/Zend/Ldap.php(884): Zend_Ldap->connect()
#1 /var/www/vendor/shardj/zf1-future/library/Zend/Auth/Adapter/Ldap.php(315): Zend_Ldap->bind('xxx\\zzz...', '*****')
#2 /var/www/vendor/shardj/zf1-future/library/Zend/Auth.php(117): Zend_Auth_Adapter_Ldap->authenticate()
#3 /var/www/application/plugins/Auth/AccessControl.php(219): Zend_Auth->authenticate(Object(Zend_Auth_Adapter_Ldap))
@Elendil4
Copy link
Author

LDAP without Zend works in my PHP 8.1 without problems.
I think it is because of the deprecated is_resource function in Zend/Ldap.
I have replaced it with

$resource !== false
or
(!$this->getResource() || $this->getResource() === false)

in several places and now it works with a single error.

_getAccountDn() returns null.

Can someone from the experts take a look at the LDAP module? I need it to be able to continue using Zend.

Would be very happy!

@matheusrrolim
Copy link

Do you guys have any ETA for the next release including this change?

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

Successfully merging a pull request may close this issue.

2 participants