Skip to content

Commit

Permalink
fix(ldapfield): only last page of LDAP results rendered
Browse files Browse the repository at this point in the history
Signed-off-by: Thierry Bugier <[email protected]>
  • Loading branch information
btry committed Mar 3, 2021
1 parent 4731788 commit 17ac461
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions inc/field/ldapselectfield.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ public function getAvailableValues() {
ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, 3);

$cookie = '';
$id = 0;
do {
if (AuthLDAP::isLdapPageSizeAvailable($config_ldap)) {
// phpcs:ignore Generic.PHP.DeprecatedFunctions
Expand All @@ -151,12 +152,12 @@ public function getAvailableValues() {
$entries = ldap_get_entries($ds, $result);
array_shift($entries);

foreach ($entries as $id => $attr) {
if (isset($attr[$attribute[0]])
&& !in_array($attr[$attribute[0]][0], $tab_values)
) {
$tab_values[$id] = $attr[$attribute[0]][0];
foreach ($entries as $attr) {
if (!isset($attr[$attribute[0]]) || in_array($attr[$attribute[0]][0], $tab_values)) {
continue;
}
$tab_values[$id] = $attr[$attribute[0]][0];
$id++;
}

if (AuthLDAP::isLdapPageSizeAvailable($config_ldap)) {
Expand Down

0 comments on commit 17ac461

Please sign in to comment.