forked from moodle/moodle
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MDL-57558 ldap: fix ldap_get_entries_moodle()
While ldap_get_entries_moodle() PHPdocs state that it returns "array ldap-entries with lower-cased attributes as indexes.", this is not true. It uses ldap_get_attributes() internally, which returns both numerically indexed attribute names, and dictionary-like entries indexed by attribute names. Current code lowercases the dictionary-like entries, but then uses the numerically indexed entries for the attribute names used as keys in the returned array. The numerically indexed names might or might not be lowercased, depending on the LDAP server and PHP version) version. E.g., OpenLDAP 2.x, Novell eDirectory 8.x and MS Active Directory return mixed-cased attribute names, and PHP 5.x and PHP 7.x don't lowercase them inside ldap_get_entries(). This is probably why all calls to ldap_get_entries_moodle() are followed by calls to array_change_key_case(), even if that shouldn't be necessary. So make sure we always return lower-cased attributs as indexes and add some unit tests to avoid regressions in the future.
- Loading branch information
1 parent
9695ca7
commit 67bebb6
Showing
4 changed files
with
289 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters