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

Issue Type: Bug Created: 2009-11-09T13:07:13.000+0000 Last Updated: 2009-11-10T05:29:47.000+0000 Status: Resolved Fix version(s): - 1.10.0 (27/Jan/10)

Reporter: Michael Croes (mycroes) Assignee: Stefan Gehrig (sgehrig) Tags: - Zend_Ldap

Related issues: - ZF-8233



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.)


Posted by Stefan Gehrig (sgehrig) on 2009-11-10T04:53:12.000+0000

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.

<pre class="highlight">
$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.

Posted by Michael Croes (mycroes) on 2009-11-10T05:29:47.000+0000

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

Have you found an issue?

See the Overview section for more details.


© 2006-2016 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.