From 51a80506b545e698f42e23763f108bf0ebc18cca Mon Sep 17 00:00:00 2001 From: Elvis McNeely Date: Sun, 12 Apr 2020 01:34:14 -0500 Subject: [PATCH 1/3] Allow consumers of symfony/ldap to force the attributes returned to be all lowercase, to reduce overall confusion and enforce a standard (if desired). --- src/Symfony/Component/Ldap/Entry.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Component/Ldap/Entry.php b/src/Symfony/Component/Ldap/Entry.php index af0edbd1f33ef..257c3de03eb2f 100644 --- a/src/Symfony/Component/Ldap/Entry.php +++ b/src/Symfony/Component/Ldap/Entry.php @@ -18,11 +18,16 @@ class Entry { private $dn; private $attributes; + private $force_lowercase_attributes; - public function __construct(string $dn, array $attributes = []) + public function __construct(string $dn, array $attributes = [], bool $force_lowercase_attributes = false) { $this->dn = $dn; $this->attributes = $attributes; + + if ($force_lowercase_attributes) { + $this->attributes = array_change_key_case($attributes); + } } /** From 84681b1e43622b0cde4a7dfaf8128da74f20c337 Mon Sep 17 00:00:00 2001 From: Elvis McNeely Date: Sun, 12 Apr 2020 01:46:12 -0500 Subject: [PATCH 2/3] Added changelog entry. --- src/Symfony/Component/Ldap/CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Symfony/Component/Ldap/CHANGELOG.md b/src/Symfony/Component/Ldap/CHANGELOG.md index fbfe926ac4e0e..e552f5cff5e20 100644 --- a/src/Symfony/Component/Ldap/CHANGELOG.md +++ b/src/Symfony/Component/Ldap/CHANGELOG.md @@ -5,6 +5,7 @@ CHANGELOG ----- * Added the "extra_fields" option, an array of custom fields to pull from the LDAP server + * Added option to allow consumers to force attribute keys to be lowercase when utilizing the Entry class. 4.3.0 ----- From 8ea3a278b80831e01513f7d2c2ec43c924db3ee4 Mon Sep 17 00:00:00 2001 From: Elvis McNeely Date: Sun, 12 Apr 2020 01:51:09 -0500 Subject: [PATCH 3/3] Coding standard patch applied. --- src/Symfony/Component/Ldap/Entry.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Component/Ldap/Entry.php b/src/Symfony/Component/Ldap/Entry.php index 257c3de03eb2f..b51bab310b0eb 100644 --- a/src/Symfony/Component/Ldap/Entry.php +++ b/src/Symfony/Component/Ldap/Entry.php @@ -26,7 +26,7 @@ public function __construct(string $dn, array $attributes = [], bool $force_lowe $this->attributes = $attributes; if ($force_lowercase_attributes) { - $this->attributes = array_change_key_case($attributes); + $this->attributes = array_change_key_case($attributes); } }