after changing admin language, cannot access admin page
-
05-10-2020 - |
Question
I have installed language extension and successfully installed on my test store. However, as soon as I have changed the admin language and press save, the admin page crashed, giving 500 error and cannot access at all. Frontend is still accessible.
I have deleted cache, but still not working.
I have contacted the developer, but if anyone has any idea how I could fix this, would be really appreciated.
EDIT:
Error Log:
PHP Fatal error: Uncaught TypeError: Argument 1 passed to iterator_to_array() must implement interface Traversable, null given in /vendor/magento/framework/View/Element/Html/Calendar.php:86
Solution
Again and again, for the unexpected 500 error, we should enable error reporting on the bootstrap. Should enable error reporting with -1 value. That will report all PHP errors.
Or need to check web server log.
app/bootstrap.php
ini_set('display_errors', -1) // Should enable error reporting with -1 value.
In your case, I'm not sure if it is a Magento bug or not. The locale Data may get the null value. Read more: https://github.com/magento/magento2/issues/5356
A temporary solution,
go to this file: vendor/magento/framework/View/Element/Html/Calendar.php
line ~65
Replace:
$localeData = (new DataBundle())->get($this->_localeResolver->getLocale());
With:
$localeData = (new DataBundle())->get('en_US');