Skip to content

Commit

Permalink
Fix error handling in ldap_get_field_from_username
Browse files Browse the repository at this point in the history
When successful, ldap_get_entries always returns an array with at least
one element inside (the count), so the check for no matches was always
successful even when no values were retrieved from LDAP.

Fixes #13331
  • Loading branch information
dregad committed Sep 20, 2011
1 parent 50c2a46 commit 79afb16
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion core/ldap_api.php
Expand Up @@ -252,7 +252,7 @@ function ldap_get_field_from_username( $p_username, $p_field ) {
ldap_unbind( $t_ds );

# If no matches, return null.
if ( count( $t_info ) == 0 ) {
if ( $t_info['count'] == 0 ) {
log_event( LOG_LDAP, "No matches found." );
return null;
}
Expand Down

0 comments on commit 79afb16

Please sign in to comment.