Re: Re: ldap_add() - null values in fields produce an "value #0 invalid per syntax" error on ldap server

From: Date: Fri, 02 Aug 2002 19:51:06 +0000
Subject: Re: Re: ldap_add() - null values in fields produce an "value #0 invalid per syntax" error on ldap server
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-110872@lists.php.net to get a copy of this message
On Thu, Jul 18, 2002 at 08:17:59PM -0500, Richard Lynch wrote: > #0 is basically just LDAP's way to represent NULL, most likely. > > > $info["mail"]=""; // <----- NULL VALUE HERE > > // The following lines also produce the same result....... > > //$info["mail"]=NULL; // <------- NULL value here > > //$info["mail"]="\0"; // <------- NULL value here > > //$info["mail"]; // <------- NULL value here > > Whoa! > > Never mind. > > Something is very broken in the LDAP stuff if '' and NULL from PHP are being > turned into NULL in LDAP, and then LDAP complains about it... Nah... "" and NULL (and I suppose "\0") are all being changed to the string "" before PHP attempts to add it. What I think the LDAP server tries to say, is that the syntax doesn't accept an empty string as value. I tried to create an LDIF file containing an attribute with no value, like this: dn: cn=stig,o=photos,dc=venaas,dc=no objectClass: photo cn: stig description: and I got exactly the same error from ldap_add(1). So this is in my opinion an LDAP issue and not a PHP issue. OpenLDAP 2 has more proper schema checking. Perhaps you could try to turn off schema checking? Or I guess in theory the syntax for the relevant attribute could be made more relaxed. You could try to ask about this on the openldap-software list if you need more LDAP help. Stig

« previous php.general (#110872) next »