View Issue Details

IDProjectCategoryView StatusLast Update
0026629mantisbtldappublic2020-03-15 15:23
Reporterdregad Assigned Todregad  
PrioritynormalSeverityminorReproducibilityhave not tried
Status closedResolutionfixed 
Target Version2.23.1Fixed in Version2.23.1 
Summary0026629: LDAP API throws PHP warning when ldap_connect() fails
Description

When ldap_connect() fails (e.g. due to invalid server specification set in $g_ldap_server), the following warnings are triggered:

SYSTEM WARNING: 'ldap_errno() expects parameter 1 to be resource, bool given' in '/path/to/core/ldap_api.php' line 50
SYSTEM WARNING: 'ldap_error() expects parameter 1 to be resource, bool given' in '/path/to/core/ldap_api.php' line 50

This is because the function returns false in this case, and this value is passed on to ldap_log_error() which expects a resource.

TagsNo tags attached.

Activities

Related Changesets

MantisBT: master-2.23 212d1834

2020-01-27 02:26

dregad


Details Diff
Fix PHP warning when ldap_connect_bind() fails

ldap_errno() / ldap_error() expect a resource, but the link identifier
is `false`.

- ldap_cache_user_data(): replace ldap_log_error() by a generic
log_event() call
- ldap_authenticate_by_username(): remove the whole if statement, which
is useless as ldap_connect_bind() will throw an error that will halt
program execution if the connection fails.

Fixes 0026629
Affected Issues
0026629
mod - core/ldap_api.php Diff File