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

2002-08-02 Thread Stig Venaas

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

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




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

2002-07-18 Thread Richard Lynch

The problem comes when fields in the html pages are left empty, which is
normal for this application.  For those familiar with the ldap_add/modify
functions in PHP, the array that is passed in has some values, say for
example title, fax, mobile, ... left empty, and therefore NULL (I have
checked, they really are NULL's stored in the array).  When the values make
it to the ldap server however, they appear to be no longer NULL's, but a
#0, and through debugging output on the ldap server, I have seen it is
generating an invalid per syntax error.

FORMs with INPUT TYPE=TEXT should be generating values of '', not NULL.

Or, at least, they always did before...

In the short term, you could probably alter any NULL value to '' before
shoving it into LDAP, and LDAP will probably like '' much better than NULL.

#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...

Start looking at http://bugs.php.net

-- 
Like Music?  http://l-i-e.com/artists.htm


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php