From c98e34303623a0f61fe6f70641a016644c57238d Mon Sep 17 00:00:00 2001 From: Thierry Bugier Date: Fri, 26 Nov 2021 08:55:37 +0100 Subject: [PATCH] fix(ldapselect): drop support for PHP 7.3 as GLPI supports 7.4 and later Signed-off-by: Thierry Bugier --- inc/field/ldapselectfield.class.php | 31 +++++++++++------------------ 1 file changed, 12 insertions(+), 19 deletions(-) diff --git a/inc/field/ldapselectfield.class.php b/inc/field/ldapselectfield.class.php index 96f9cd5e7..5ecdf55e3 100644 --- a/inc/field/ldapselectfield.class.php +++ b/inc/field/ldapselectfield.class.php @@ -142,26 +142,19 @@ public function getAvailableValues() { ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, 3); do { if (AuthLDAP::isLdapPageSizeAvailable($config_ldap)) { - // phpcs:ignore Generic.PHP.DeprecatedFunctions - if (version_compare(PHP_VERSION, '7.3') < 0) { - // phpcs:ignore Generic.PHP.DeprecatedFunctions - ldap_control_paged_result($ds, $config_ldap->fields['pagesize'], true, $cookie); - $result = ldap_search($ds, $config_ldap->fields['basedn'], $ldap_values->ldap_filter, $attribute); - } else { - $controls = [ - [ - 'oid' => LDAP_CONTROL_PAGEDRESULTS, - 'iscritical' => true, - 'value' => [ - 'size' => $config_ldap->fields['pagesize'], - 'cookie' => $cookie - ] + $controls = [ + [ + 'oid' => LDAP_CONTROL_PAGEDRESULTS, + 'iscritical' => true, + 'value' => [ + 'size' => $config_ldap->fields['pagesize'], + 'cookie' => $cookie ] - ]; - $result = ldap_search($ds, $config_ldap->fields['basedn'], $ldap_values->ldap_filter, $attribute, 0, -1, -1, LDAP_DEREF_NEVER, $controls); - ldap_parse_result($ds, $result, $errcode, $matcheddn, $errmsg, $referrals, $controls); - $cookie = $controls[LDAP_CONTROL_PAGEDRESULTS]['value']['cookie'] ?? ''; - } + ] + ]; + $result = ldap_search($ds, $config_ldap->fields['basedn'], $ldap_values->ldap_filter, $attribute, 0, -1, -1, LDAP_DEREF_NEVER, $controls); + ldap_parse_result($ds, $result, $errcode, $matcheddn, $errmsg, $referrals, $controls); + $cookie = $controls[LDAP_CONTROL_PAGEDRESULTS]['value']['cookie'] ?? ''; } else { $result = ldap_search($ds, $config_ldap->fields['basedn'], $ldap_values->ldap_filter, $attribute); }