Skip to content

Commit bb77a61

Browse files
authored
Update ldap_api.php (PHP >=8.1.0 compatibility) (#370)
* Update ldap_api.php * Update comment in ldap_api.php
1 parent 31fc084 commit bb77a61

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

lib/functions/ldap_api.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,11 @@ function ldap_connect_bind( $authCfg, $p_binddn = '', $p_password = '')
5454
// if you use - echo 'ldap_errno:' . ldap_err2str(ldap_errno($t_ds ));
5555
// you will get Success!!!, no matter what has happened
5656
//
57-
if( $t_ds !== false && $t_ds > 0 )
57+
// NOTE regarding PHP >=8.1.0
58+
// type of return parameter of ldap_connect has changed,
59+
// see https://www.php.net/manual/de/function.ldap-connect.php
60+
//
61+
if( ( is_resource($t_ds) && $t_ds > 0 ) || $t_ds !== false )
5862
{
5963
$ret->handler=$t_ds;
6064
ldap_set_option($t_ds, LDAP_OPT_PROTOCOL_VERSION, $authCfg['ldap_version']);
@@ -129,7 +133,6 @@ function ldap_connect_bind( $authCfg, $p_binddn = '', $p_password = '')
129133
}
130134

131135

132-
// ----------------------------------------------------------------------------
133136
// Attempt to authenticate the user against the LDAP directory
134137
function ldap_authenticate( $p_login_name, $p_password )
135138
{

0 commit comments

Comments
 (0)