Unverified Commit 61fff6bb authored by Côme Chilliet's avatar Côme Chilliet
Browse files

:ambulance: fix(templates) Fix PHP error when applying templates with unique condition

issue #6019
Showing with 7 additions and 4 deletions
+7 -4
......@@ -239,12 +239,15 @@ class templateHandling
foreach ($generator as $value) {
$filter = '('.ldap_escape_f($unique).'='.ldap_escape_f($value).')';
$ldap->search($filter, ['dn']);
if (
($ldap->count() == 0) ||
(($target !== NULL) && ($ldap->count() == 1) && ($ldap->getDN() == $target))
) {
if ($ldap->count() == 0) {
return $value;
}
if (($target !== NULL) && ($ldap->count() == 1)) {
$attrs = $ldap->fetch();
if ($attrs['dn'] == $target) {
return $value;
}
}
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment