From f403a6a53555474ef77cf304669c16dba685816e Mon Sep 17 00:00:00 2001 From: valleet01 <thibaut.vallee@unicaen.fr> Date: Thu, 21 Mar 2024 11:25:41 +0100 Subject: [PATCH] fixe pour php>=8.1 : ldap_get_attibutes ne prend plus une ressources mais une LDAP\Connection --- src/UnicaenLdap/Service/AbstractService.php | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/UnicaenLdap/Service/AbstractService.php b/src/UnicaenLdap/Service/AbstractService.php index a604b5f..cf34c10 100644 --- a/src/UnicaenLdap/Service/AbstractService.php +++ b/src/UnicaenLdap/Service/AbstractService.php @@ -326,20 +326,19 @@ abstract class AbstractService implements /** * Retourne un tableau d'attributs * - * @param resource $resource + * @param resource|\Ldap\Connection $resource * @param resource $entry * @return null|array + * @desc depuis php 8.1 $resource est de type Ldap\Connection */ private function __getEntryAttributes($resource, $entry) { - if (!is_resource($resource)) { + if (!is_resource($resource) && !($resource instanceof \Ldap\Connection)) { return null; } - $berIdentifier = null; - $name = ldap_first_attribute( - $resource, $entry, $berIdentifier + $resource, $entry ); $attributes = array(); @@ -361,8 +360,7 @@ abstract class AbstractService implements $attributes[$attrName] = $data; $name = ldap_next_attribute( - $resource, $entry, - $berIdentifier + $resource, $entry ); } ksort($attributes, SORT_LOCALE_STRING); -- GitLab