Suitecrm: LDAPAutheticate warnings in log

Created on 19 Jul 2017  路  6Comments  路  Source: salesagility/SuiteCRM


Issue


Updated to latest release yesterday evening, now have 15k lines of warnings in Log:
PHP Warning: Declaration of LDAPAuthenticateUser::loadUserOnLogin($name, $password) should be compatible with SugarAuthenticateUser::loadUserOnLogin($name, $password, $fallback = false, $PARAMS = Array) in C:\inetpub\suitecrm\modules\Users\authentication\LDAPAuthenticate\LDAPAuthenticateUser.php on line 52
Declaration of LDAPAuthenticateUser::authenticateUser($name, $password) should be compatible with SugarAuthenticateUser::authenticateUser($name, $password, $fallback = false) in C:\inetpub\suitecrm\modules\Users\authentication\LDAPAuthenticate\LDAPAuthenticateUser.php on line 52

Anyone know how to fix this?

Context


Your Environment

  • SuiteCRM Version used: 7.9.3
  • Browser name and version (e.g. Chrome Version 51.0.2704.63 (64-bit)): FF 52
  • Environment name and version (e.g. MySQL, PHP 7): MSSQL PHP7
  • Operating System and version (e.g Ubuntu 16.04): Win 2008R2
Moderate Fix Proposed Bug

All 6 comments

@halest can you please try this change and see if it solves the issue for you?

https://github.com/pgorod/SuiteCRM/commit/9e132f35596cec0e2eda834a13aa38daac33703e

(now updated with the missing parenthesis)

Make sure you also include () after PARAMS = Array

@pgorod Thank you for the effort. I have been playing around with the commits and it seems the least-amount-of-change-solution to get rid of the warnings while keeping it functional would be to change the function declarations like so:
function authenticateUser($name, $password) {
to
function authenticateUser($name, $password, $fallback = false) {
and
function loadUserOnLogin($name, $password) {
to
function loadUserOnLogin($name, $password, $fallback = false, $PARAMS = Array()) {

So good on my end

@Dillon-Brown can you please add a commit to your PR with

function authenticateUser($name, $password, $fallback = false) {

After change:
function loadUserOnLogin($name, $password) {
to
function loadUserOnLogin($name, $password, $fallback = false, $PARAMS = Array()) {
there is a new warning in logfile:
PHP Warning: in_array() expects parameter 2 to be array, string given in /var/www/suitecrm/modules/Users/authentication/LDAPAuthenticate/LDAPAuthenticateUser.php on line 124

@erikschwalbe actually I think that warning is a sign of a bug: the order of the parameters in that in_array seems to be inverted. Not only it's getting a string where it expects an array, it's also getting an array where it expects a string.

I believe probably what was intended in that line was this:

if (!in_array($GLOBALS['ldap_config']->settings['ldap_group_user_attr']), $attrs) {
     $attrs[] = $GLOBALS['ldap_config']->settings['ldap_group_user_attr'];
}

Click to check out in_array syntax.

@Dillon-Brown what do you think?

Was this page helpful?
0 / 5 - 0 ratings