2

now I have an error in Magento 2 that shows this error:

There has been an error processing your request

Warning: Cannot use a scalar value as an array in /home/web/domains/web.com/public_html/vendor/magento/framework/Session/SessionManager.php on line 492

Do you know how to solve this? I use Magento 2.3.5

1 Answer 1

3

Its a bug just change the line 492 with this

do you see this line

Replace this

protected function _getHosts()
    {
        return $_SESSION[self::HOST_KEY] ?? [];
    }

with this

protected function _getHosts()
    {
        
       return isset($_SESSION[self::HOST_KEY]) ? [$_SESSION[self::HOST_KEY]] : [];

    }
8
  • Hello, I have this in my 492, I replace with your code? $hosts[$host] = true; Thanks
    – Carlos
    Commented Aug 3, 2020 at 9:20
  • check updated ans
    – Pramod
    Commented Aug 3, 2020 at 9:35
  • Thanks! I have edited :)
    – Carlos
    Commented Aug 3, 2020 at 9:42
  • is it working ?
    – Pramod
    Commented Aug 3, 2020 at 9:42
  • I don't know as I cleared cookies before from the internet browser and was ok, for now I don't see the error
    – Carlos
    Commented Aug 3, 2020 at 9:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.