Community

Captcha ver 3.3.3 not allowing login to manager

When trying the login after upgrading to 3.3.3 the Error “Array” is displayed in red.
Disabling in system settings does not help.
Disabling the plugin allows login.

Checking the log file I get:

[2019-08-08 20:09:33] (WARN @ /var/www/clients/client1/web1/web/manager/controllers/default/security/login.class.php : 205) PHP notice: Array to string conversion

I have a backup of the database before I upgraded.

The code was originally:

$rt = $modx->lexicon(‘login_captcha_error’);

version 3.3.3 has $rt returned as an array

$rt = array($modx->lexicon(‘login_captcha_error’));

This is the same for all the code for “OnBeforeManagerLogin” where $rt is returned.

Is this a bug or am I doing something wrong?

MODX 2.7.0-pl with manager captcha 3.3.3

1 Like

It sounds like it may be a bug. I’m looking into it.

It would really help me to know:

1. Were you using Captcha version 3.3.2?
2. Is the Login package up to date?

You can get into the Manager by turning off Captcha in the DB. In the modx_system_settings table. Set the value of captcha.enabled to 0. Then manually delete all files in the core/cache directory.

Once you’re in the Manager, you should be able to revert to the previous version of Captcha in Package Manager.

I did that, I got in, just wondered what I did wrong.

Is it because I am on MODX 2.7.0 ?

Is it because I am on MODX 2.7.0 ?

It shouldn’t be, unless things have changed again.

Are you using the mathstring option?

I have the Login Extra which is not up to date (login-1.9.5-pl)

I didn’t think the two had dependencies

Yes using the mathstring

Try updating the Login extra, that could be the issue.

No that didn’t help… Deleted everything in the cache folder as well.

For whatever reason my MODX install doesn’t like $rt being an array.

I’ll have to do some testing.

Do you have this at line 72 of the core/model/modx/processors/security/login.class.php file?

        $response = $this->modx->invokeEvent($this->isMgr ? "OnBeforeManagerLogin" : "OnBeforeWebLogin", $onBeforeLoginParams);

    if (is_array($response)) {
        foreach ($response as $key => $value) {
            if ($value !== true) {
                return $value;
            }
        }
    }

    return '';

Yes

I thought I might install a clean version of the latest MODX on a VM and try that.

Could it be a php bug?

PHP Version 7.2.15-1+ubuntu16.04.1+deb.sury.org+1

I can’t duplicate this at all. It’s working perfectly for me in MODX 2.7.1 ( PHP Version 7.1.14), with or without the Mathstring option. The only thing I can think of is to make sure the Captcha plugin is enabled.

Scratch that. I’m able to duplicate it on another server, with MODX 2.7.1, and PHP Version 7.1.31.

I doubt if it’s the MODX or PHP version differences. It works on XAMPP/localhost, but not on a real *nix server. WinMerge is telling me that several of the files have different line endings, so that may be the problem, though I don’t know how that could have happened.

1 Like

The backup of my database with 3.3.2 in shows it returning a string not an array

why did it change to an array in 3.3.3 ?

Anyway glad you have managed to reproduce.

1 Like

Thanks for all your help. I’ve released version 3.3.4, with the fix.

2 Likes