magento2: Can't login to frontend after upgrading to 2.4.0

Preconditions (*)

  • Shop in Developer mode
  • PHP 7.4.9
  • PHP Module “Sodium” is installed.
  • libsodium is installed with version 1.0.18

Steps to reproduce (*)

  1. Upgrade shop from EE 2.3.5-p2 to EE 2.4.0
  2. Disable Module “Magento_TwoFactorAuth” (not sure if it makes a difference, but I mention all steps I made)
  3. Try to login to frontend as customer.

Expected result (*)

  1. Login should work

Actual result (*)

  1. Notice: Undefined offset: 2 in /home/x/y/vendor/magento/framework/Encryption/Encryptor.php on line 591
  2. An unspecified error occurred. Please contact us for assistance.

image

Appearing after modifying vendor\magento\module-customer\Controller\Account\LoginPost.php to make it show more details by adding this code:

$message = $e->getMessage();
$this->messageManager->addError($message);

before

$this->messageManager->addErrorMessage(
     __('An unspecified error occurred. Please contact us for assistance.')
);

I tried clearing the browser cache and cookies, but it did not helped.


Please provide Severity assessment for the Issue as Reporter. This information will help during Confirmation and Issue triage processes.

  • Severity: S0 - Affects critical data or functionality and leaves users without workaround.
  • Severity: S1 - Affects critical data or functionality and forces users to employ a workaround.
  • Severity: S2 - Affects non-critical data or functionality and forces users to employ a workaround.
  • Severity: S3 - Affects non-critical data or functionality and does not force users to employ a workaround.
  • Severity: S4 - Affects aesthetics, professional look and feel, “quality” or “usability”.

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 29 (15 by maintainers)

Most upvoted comments

@mrtuvn: no idea, we are holding off with upgrading to Magento 2.4.0 / PHP 7.4 until Magento becomes a bit more stable. We’ll probably start using it when 2.4.1 or 2.4.2 is out, it’s too unstable now to start using it in my opinion.

If I run into this within some months, I can take a look, but it sounds like Eddcapone is already debugging it a bit, so maybe he’ll find the root cause.

@hostep Oh, I see. Thx! 👍

Yes, but that’s using php-cli, not php invoked by the webserver, which can give you different results 🙂

Ok thanks for the info Ihor!

@Eddcapone: based on your previous comment, if i have to guess, the sysadmins installed the sodium php extension but probably forgot to restart php-fpm (or your webserver), hence why php-cli reported it was installed but when using php in the webserver context it still didn’t see it. A better way to verify if it was installed, is to create a dummy php file with <?php phpinfo(); as contents and requesting it via the webserver. Then see if sodium is being reported as installed (and make sure libsodium is at least version 1.0.13). Should show you something like this: Screenshot 2020-09-17 at 16 03 05

@Eddcapone one more workaround - you could add following param to your env.php, and it will generate static files automatically, similar to developer mode 😃

return array(
   ...
   'static_content_on_demand_in_production' => 1,
   ...
);

More info here: https://devdocs.magento.com/cloud/env/variables-global.html#scd_on_demand

@ihor-sviziev Thats no option because it is a developer environment and I would need to deploy static files every time. But I stay at PHP 7.3 until it is fixed.

Are you using developer magento mode ?

On Mon, 14 Sep 2020 at 14:17 Eddcapone notifications@github.com wrote:

@ihor-sviziev https://github.com/ihor-sviziev , I get Nothing to install or update if I execute composer install in this project.

@sidolov https://github.com/sidolov I can share my config with your if you like, where is it located? How can I give you the necessary informations?

The error in line 591 makes perfect sense to me. Magento tries to access an undefined offset, because $hashVersionMap has only two entries and it tries to access the third one. But why does it not trigger the same error with PHP 7.3 then?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/magento/magento2/issues/29865#issuecomment-691987776, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAOJOUO4HIXUYJO22QG2Y53SFX3VNANCNFSM4QS5EUEA .

The admins just installed sodium, now I get:

string(5) "7.4.9"
bool(true)
bool(true)

But the login still fails with

Notice: Undefined offset: 2 in /home/x/y/vendor/magento/framework/Encryption/Encryptor.php on line 591 An unspecified error occurred. Please contact us for assistance.

image

So I switched back to PHP 7.3 again.

@Eddcapone could you provide output of the following command?

php -r "var_dump(PHP_VERSION, extension_loaded('sodium'), defined('SODIUM_CRYPTO_PWHASH_ALG_ARGON2ID13'));"

I have following output and seems like everything works fine:

string(6) "7.3.21"
bool(true)
bool(true)
string(5) "7.4.9"
bool(true)
bool(true)