public function testImplodeDnWithUtf8Characters()
 {
     $expected = 'uid=rogasawara,ou=営業部,o=Airius';
     $dnArray = array(array("uid" => "rogasawara"), array("ou" => "営業部"), array("o" => "Airius"));
     $dn = Zend_Ldap_Dn::implodeDn($dnArray);
     $this->assertEquals($expected, $dn);
 }
Beispiel #2
0
 /**
  * Copies a LDAP entry from one DN to another DN.
  *
  * @param  string|Zend_Ldap_Dn $from
  * @param  string|Zend_Ldap_Dn $to
  * @param  boolean             $recursively
  * @return Zend_Ldap Provides a fluid interface
  * @throws Zend_Ldap_Exception
  */
 public function copy($from, $to, $recursively = false)
 {
     $entry = $this->getEntry($from, array(), true);
     if ($to instanceof Zend_Ldap_Dn) {
         $toDnParts = $to->toArray();
     } else {
         $toDnParts = Zend_Ldap_Dn::explodeDn($to);
     }
     $this->add($to, $entry);
     if ($recursively === true && $this->countChildren($from) > 0) {
         $children = $this->_getChildrenDns($from);
         foreach ($children as $c) {
             $cDnParts = Zend_Ldap_Dn::explodeDn($c);
             $newChildParts = array_merge(array(array_shift($cDnParts)), $toDnParts);
             $newChild = Zend_Ldap_Dn::implodeDn($newChildParts);
             $this->copy($c, $newChild, true);
         }
     }
     return $this;
 }