I'm using Magento 2.2.1 CE.I got following error when I opened admin panel

   "0":"Warning: Cannot use a scalar value as an array in 
\\vendor\\magento\\framework\\Session\\SessionManager.php on line 470"

How to solve this ?

  • This above fix still works for magento 2.3.3, but the line is 508 not 482. Commented Nov 21, 2019 at 19:48

2 Answers 2


It's a Magento bug for not returning array if session has a value.

Temporary fix is, change line 482 to:

return isset($_SESSION[self::HOST_KEY]) ? [$_SESSION[self::HOST_KEY]] : [];

The fastest way to overcome the issue is to clear site data storage in your browser to refresh a session data

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.