Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions lib/Horde/Ldap/Search.php
Original file line number Diff line number Diff line change
Expand Up @@ -264,11 +264,19 @@ public function sortedAsArray(array $attrs = ['cn'], $order = SORT_ASC)
}

// Build columns for array_multisort(). Each requested attribute is one
// row.
// row. Not every entry necessarily has every requested attribute, so
// we provide an empty-string fallback to avoid undefined array key
// warnings in PHP 8.0+ while keeping the reference binding that
// array_multisort() requires.
$columns = [];
foreach ($attrs as $attr_name) {
foreach ($to_sort as $key => $row) {
$columns[$attr_name][$key] = & $to_sort[$key][$attr_name][0];
if (isset($to_sort[$key][$attr_name][0])) {
$columns[$attr_name][$key] = & $to_sort[$key][$attr_name][0];
} else {
$to_sort[$key][$attr_name] = [''];
$columns[$attr_name][$key] = & $to_sort[$key][$attr_name][0];
}
}
}

Expand Down
Loading