|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2001-08-14 09:41 UTC] christian at metamerge dot com
Hi, I am working with PHP 4.0.5 and OpenLDAP 2.0.11. I encounter problems when modifying some entries with attributes containing special chars (such as ?, ?...). The error returned by the LDAP server is "invalid syntax". I have read some documentation about this. OpenLDAP can accept special chars, provided values are base64-encoded, when we use the tools that come with the application (ldapadd, ldapmodify, etc.). But how to do this from PHP functions? I tried to base64_encode the values, it naturally didn't do the trick (those values were considered as normal, and thus were not decoded - this polutes my directory.) Same goes for urlencoding. Please help! PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Oct 27 11:00:01 2025 UTC |
// Here is a function to translate all values of a multi-dimensional array to UTF8 function encoder ($array) { while ( list ($key, $val) = each ($array) ) { if (!is_array($val)) $array[$key] = utf8_encode($val); else $array[$key] = encoder ($val); } return $array; } //Here is a call where // - $conn_id is a valid connection ID // - $dn is the dn of the object to add // - $array is the array containing the values of the attributes indexed by name $array = encoder($arr); ldap_add($conn_id, $dn, $array); // this call fails // - if $array contains a special char (e.g ?, ?...) , thus returning SYNTAX ERROR // - if $dn contains a special char (e.g ?, ?...) , thus returning No Such Object