[Kolab-devel] undefined indexes in several arrays

Steffen Hansen steffen at klaralvdalens-datakonsult.se
Tue Sep 13 15:06:11 CEST 2005


On Thursday 18 August 2005 16:26, Andreas Hasenack wrote:
> kolab seems to make several assumptions about array indexes always
> existing. For example (referer ommited for brevity):
>
> Undefined index:  kolabfilter-verify-from-header in
> /var/www/html/kolab/admin/service/index.php on line 87, ... Undefined
> index:  kolabfilter-allow-sender-header in
> /var/www/html/kolab/admin/service/index.php on line 88, ... Undefined
> index:  kolabfilter-reject-forged-from-header in
> /var/www/html/kolab/admin/service/index.php on line 89, ...
>
> and many more.
>
> The code there reads:
> $kolabfilterverifyfrom = $attrs['kolabfilter-verify-from-header'][0];
> $kolabfilterallowsender =
> $attrs['kolabfilter-allow-sender-header'][0];
> $kolabfilterrejectforgedfrom =
> $attrs['kolabfilter-reject-forged-from-header'][0];
>
> Some of these attributes only get inserted into LDAP when the user
> changes the value to either TRUE or FALSE via the admin interface.
> After that, they are always there.
>
> So, is this an LDAP database initialization problem? Or should the
> code be more careful and check if the index exists before attempting
> to use it? Has anybody else seen this?

When not present in LDAP those should default to false. Undefined in PHP 
is false, so the code works correctly. It would of course be an 
improvement to check for existence before reading the value, but the 
end-effect is the same.

Eventually I might get around to fix it, but it's pretty low on my list 
right now.

regards
-- 
Steffen Hansen          |       Klarälvdalens Datakonsult AB
Senior Software Engineer|       http://www.klaralvdalens-datakonsult.se
                        |
                        |       Platform-independent
                        |       software solutions




More information about the devel mailing list