Skip to content

Commit 65ac9ef

Browse files
authored
Merge pull request #509 from nextcloud/fix/php-compat
Starting PHP 8.1 the LDAP connection is an object
2 parents e7f6954 + f3ab8d3 commit 65ac9ef

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

lib/LDAPConnect.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public function connect() {
5151

5252
// Connecting to LDAP - TODO: connect directly via LDAP plugin
5353
$cr = ldap_connect($ldapHost, $ldapPort);
54-
if(!is_resource($cr)) {
54+
if(!is_resource($cr) && !is_object($cr)) {
5555
throw new ServerNotAvailableException('LDAP server not available');
5656
}
5757

lib/LDAPUserManager.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ public function setDisplayName($uid, $displayName) {
122122
);
123123
}
124124

125-
if (!is_resource($connection)) {
125+
if (!is_resource($connection) && !is_object($connection)) {
126126
$this->logger->debug('LDAP resource not available', ['app' => 'ldap_write_support']);
127127
throw new ServerNotAvailableException('LDAP server is not available');
128128
}

0 commit comments

Comments
 (0)