ZF-8263: Zend_Ldap converts attribute names of ldap objects to lowercase


In Zend_Ldap_Collection_Interface_Default the current() function will convert all ldap attributes to lowercase (using strtolower). Besides the (unneeded) possible performance impact I'd also just like to get the attribute name as it is stored in my directory server.

There is no comment in the signaling whether this might provide better compatibility between Active Directory and OpenLDAP, so I'm assuming it's just because someone thought this was easier to use (which is in my opinion a wrong decision.)


Fixed in trunk (r18922).

I added a low-level option to turn off the auto-strtolower in {{Zend_Ldap_Collection_Iterator_Default}}. This allows you to set the attributes' name treatment on a result set explicitly.

$entries = $this->_getLdap()->search('(objectClass=account)');
foreach ($entries as $entry) {
    // ...

The available options are: - {{Zend_Ldap_Collection_Iterator_Default::ATTRIBUTE_NATIVE}}: no change - {{Zend_Ldap_Collection_Iterator_Default::ATTRIBUTE_TO_LOWER}}: lowercase attributes (default) - {{Zend_Ldap_Collection_Iterator_Default::ATTRIBUTE_TO_UPPER}}: uppercase attributes - a vaid callback accepting the attribute's name as it's only argument and returning the new attribute's name

A complete removal of the attributes' name sanitation process would break BC. LDAP attribute names are case insensitive ( by convention so actually the loss of information by lowercasing the names is negligible.

Thanks for pointing out the case insensitivity of names for LDAP itself. Also, thanks for the fix.