tags:

views:

138

answers:

1

I have a program here that uses the ldap_add, when i try to run the program, it displays an error:

Warning: ldap_add() [function.ldap-add]: Add: Invalid syntax in /var/www/suey/costcenter.20090617.php on line 780

My lil' code here is:

 $ldapservers='ourServer';
 $ds = ldap_connect($ldapservers);
 if ($ds){
           $r = ldap_bind($ds, $ldaprootun, $ldaprootpw);
           $add = ldap_add($ds, "uid=$fuid, $ldapbasedn", $infonew);

  }

ldapbasedn is set to o=ourGroup; infonew is an array of entries (person information) and am so sure that the array is not empty because i already tested it. the uid is not empty too. What could be wrong? Is it the entries(array)? or the server am trying to connect to? I tried testing the ldap_bind, and it also works well too..hmmm..

Pls help.. thanks!


I found the problem.. it's in the index infonew["createdBy"] = getenv("REMOTE_USER"); it returns NULL! now, is that right?

A: 

Can you please post a var_dump($infonew) (or print_r($infonew))?

I strongly assume that there is some data in $infonew that cannot be written to the LDAP server.

EDIT:

You cannot use null in the LDAP data array. Either strip the appropriate key (createdBy) from the array or set the value to array().

Stefan Gehrig