The following error occurs while we using Redis for session storage Or file session storage :
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
– Please follow the below steps to resolve it :
Step 1: Please first override the following file: vendor/magento/framework/Session/SessionManager.php
Step 2: Open SessionManager.php and find following function ‘_getHosts()’ replace below line from this function :
return $_SESSION[self::HOST_KEY] ?? [];
replace it with:
return isset($_SESSION[self::HOST_KEY]) ? [$_SESSION[self::HOST_KEY]] : [];
That’s it! The error should be solved now.


 
                              