15 June 07
Mysterious empty entries (rows) coming from PHP originating from LDAP
- check for how LDAP raw results are handled
- following causes the above error:
if( !is_array( $result[ 'myMultivaluedAttrib' ] ) ) {
$result[ 'myMultivaluedAttrib' ]= array( $result[ 'myMultivaluedAttrib' ] );
}
Fix: add the following code before the above block:
if( !isset( $result[ 'myMultivaluedAttrib' ] ) ) {
$result[ 'myMultivaluedAttrib' ]= array();
}
LDAP in PHP: ldap_get_entries(..) – it returns single-valued attributes the same way as multi-valued (so you have to access the only value of a single-valued attribute the same way as 1st value of a multi-valued attrib) – except for DN which is returned at the ‘top’ level:
[count] => 4
[dn] => cn=Peter Kehl,ou=…,o=users