[dev] Today's little ldap schema witch project and a horde.schema diff.

Jon Parise jon@horde.org
Thu, 11 Apr 2002 00:24:35 -0400


On Fri, Apr 05, 2002 at 07:36:36PM -0800, Edwin Culp wrote:

> We still can't send an empty string to ldap_modify.  It should be empty
> but shows up as #0.  We all know that a ldap_modify to an attribute with
> and empty value will delete the attribute in openldap

I researched this a bit more.  Apparently, that is only true
under OpenLDAP 1.x.  Under OpenLDAP 2.x, passing an empty
attribute results in the syntax error you are seeing.

The way to delete attributes in compliance with OpenLDAP 2.x is
to call ldap_mod_del(), but that requires you to know the
existing value of the attribute in the LDAP directory.  Because
we don't know the previous preference value, we'd have to search
for it again, get the previously stored value, and perform the
attribute deletion based on that old value.

However ...

> and that is what we want in the above cases and in the hordeThemes that
> Jon and I have discussed several times.

I'm not entirely sure that's what we want now that I think about
it.  We want the ability to store an empty string as a preference
value instead of just using the system default value for that
preference.  Imagine the case where the system default (specified
in config/prefs.php) is not empty; then, the user would never be
able to save an empty value for the preference.

Because we can't save an empty string, the kludgy solution would
be to define some new string constant (e.g. 'HORDE-EMPTY-STRING')
and store that as the equivalent of an empty preference.  Upon
reading the preferences back in, we'd check for that special
string and convert it into an empty string value in PHP code.

That seems icky, but I don't know how empty strings are supported
to be stored in LDAP.

Comments on this would be appreciated.

-- 
Jon Parise (jon@csh.rit.edu)  .  Information Technology (2001)
http://www.csh.rit.edu/~jon/  :  Computer Science House Member