mirror of
https://gitlab.easter-eggs.com/ee/ldapsaisie.git
synced 2024-11-22 09:59:06 +01:00
LSldap :: getAttr(): be sure to return on array when $multiple is true
This commit is contained in:
parent
f3e7557421
commit
58dbdcb7fe
1 changed files with 2 additions and 1 deletions
|
@ -333,12 +333,13 @@ class LSldap extends LSlog_staticLoggerClass {
|
||||||
* @param string $name Name of a attribute
|
* @param string $name Name of a attribute
|
||||||
* @param boolean $multiple true if we must return array
|
* @param boolean $multiple true if we must return array
|
||||||
*
|
*
|
||||||
* @return mixed Found value (or array of values) or null
|
* @return ($multiple is True ? array<int,string> : string|null) Found value (or array of values) or null
|
||||||
*/
|
*/
|
||||||
public static function getAttr($attrs, $name, $multiple=false) {
|
public static function getAttr($attrs, $name, $multiple=false) {
|
||||||
$name = strtolower($name);
|
$name = strtolower($name);
|
||||||
foreach ($attrs as $k => $v) {
|
foreach ($attrs as $k => $v) {
|
||||||
if (strtolower($k) === $name) {
|
if (strtolower($k) === $name) {
|
||||||
|
$v = ensureIsArray($v);
|
||||||
return $multiple ? $v : $v[0];
|
return $multiple ? $v : $v[0];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue