Issues

ZF-11611: _ensureRdnAttributeValues() and multi-valued RDN attributes

Description

I'm having an issue with {{Zend_Ldap_Node::_ensureRdnAttributeValues()}} that changes the value of the {{cn}} attribute.

Considering the LDAP group defined as follows:


dn: cn=funkygroup,ou=Groups,dc=domain,dc=local
objectClass: groupOfNames
objectClass: top
cn: The Funkygroup
cn: funkygroup
member: uid=john-doe,ou=Users,dc=domain,dc=local

The special thing here is that the {{cn}} attribute has 2 values: "The Funkygroup" and "funkygroup"

When creating a {{Zend_Ldap_Node}} with {{Zend_Ldap_Node::fromArray()}}, {{Zend_Ldap_Node::ensureRdnAttributeValues()}} gets called and get rid of the "_The Funkygroup" {{cn}} value because it is not part of the RDN of the node.

+Reproduce code:+


<?php

$data = array(
    'dn' => 'cn=funkygroup,ou=Groupes,dc=domain,dc=local',
    'objectClass' => array(
        'groupOfNames',
        'top',
    ),
    'cn' => array(
        'The Funkygroup',
        'funkygroup',
    ),
    'member' => 'uid=john-doe,ou=Users,dc=domain,dc=local',
);

$node = Zend_Ldap_Node::fromArray($data, true);
print_r($node->getChangedData());

+Expected result:+

Array
(
)

+Actual result:+

Array
(
    [cn] => Array
        (
            [0] => funkygroup
        )

)

I understand the need to ensure that the attributes used in the RDN are present in the {{Node}} (goal of {{Zend_Ldap_Node::_ensureRdnAttributeValues()}}) but when everything is already correctly set (each attributes present in the RDN are well defined): calling that method shouldn't break anything (or it should be possible to avoid calling such method)

Comments

fixed in r24351