Active Directory からのオブジェクト管理を容易にするために、PHP の API を介した LDAP 用の軽量のモデル マネージャーを作成しました。
すべて正常に実行されますが、すべての値を変更しても複数の値を持つ属性を更新するときに問題が発生し、トランザクションは「型または値が存在します」というエラーで失敗し、属性はデータベースで変更されません。
私が使用しているテストケースは、ユーザーの多値の「説明」フィールドを変更することです。新しい値を追加したり、値の配列全体を変更したりすると、トランザクションは常に失敗します。
コードの一部は次のとおりです。
if (count($mod_attr) > 0)
{
$ret = @ldap_mod_replace($this->getHandler(), $dn, $mod_attr);
if ($ret === false)
{ $this->log(sprintf("LDAP ERROR '%s' -- Modifying {%s}.", ldap_error($this->getHandler()), print_r($mod_attr, true)), \SlapOM\LoggerInterface::LOGLEVEL_CRITICAL);
throw new LdapException(sprintf("Error while MODIFYING values <pre>%s</pre> in dn='%s'.", print_r($mod_attr, true), $dn), $this->getHandler(), $this->error);
}
$this->log(sprintf("Changing attribute {%s}.", join(', ', array_keys($mod_attr))));
}
完全なコードは [github のこちら] ( https://github.com/chanmix51/SlapOM/blob/master/lib/SlapOM/Connection.php#L115 [github]) にあります。
ログには次の行が表示されます。
2013-06-04 10:39:54 | => MODIFY dn='CN=HUBERT Gregoire,OU=...
2013-06-04 10:39:54 | => LDAP ERROR 'Type or value exists' -- Modifying {Array
(
[description] => Array
(
[0] => Description 2
[1] => Description 3
)
)}
前の値が["description" => ['Description 1']]
. 私が取得していない、または間違っていることはありますか?