Skip to content

Commit

Permalink
fix(ldapselect): drop support for PHP 7.3 as GLPI supports 7.4 and later
Browse files Browse the repository at this point in the history
Signed-off-by: Thierry Bugier <tbugier@teclib.com>
  • Loading branch information
btry committed Nov 26, 2021
1 parent 7033c3a commit c98e343
Showing 1 changed file with 12 additions and 19 deletions.
31 changes: 12 additions & 19 deletions inc/field/ldapselectfield.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit c98e343

Please sign in to comment.