My magento 2 website is crashed: Unknown or bad timezone () error
I don't know exactly HOW it happened, but in my scenario the core_config_data
table was corrupted. It had added a new row somehow with path
set to general
and value
set to NULL
:
This caused Magento\Framework\App\Config\ScopeConfigInterface::getValue()
on public/vendor/magento/framework/Stdlib/DateTime/Timezone.php::scopeDate()
to return NULL
instead of Europe/Amsterdam
. Needless to say, when the \DateTimeZone()
object was created it immediately threw this exception.
So if anyone else encounters this error, your configuration might be an obvious place to start looking.
The timezone should be one of the List of Supported Timezones. Seems that you are using empty timezone.
Try to detect the current store timezone using the next query:
SELECT * FROM `core_config_data` WHERE `path` = 'general/locale/timezone'
If result is empty, try to insert the default value:
INSERT INTO `core_config_data`(`path`, `value`) VALUES ('general/locale/timezone', 'Europe/Moscow')
If this does not help - try to search inside the project: where the code throws an error. Then try to debug it: detect from where the empty timezone value is coming.