11

enter image description here

When i am accessing my magento website i am getting errors

DateTimeZone::__construct(): Unknown or bad timezone ()

on Block and CMS pages and all my product list pages on frontend shows 404 page not found error. Please check and help me out to fix this issue ASAP. You can check this problem at here. I solve this error by restoring my backup site.

But if you know why this error is coming then this question is still open

  • My answer hasn't helped you? – Siarhey Uchukhlebau Sep 8 '16 at 11:29
  • I'm currently having the same problem in Magento 2.1.3. The homepage works, but all other pages don't. My timezone is properly set in core_config_data to Europe/Amsterdam. – Giel Berkers Jan 19 '17 at 14:18
31

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:

wrong configuration in database

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.

  • 3
    I had the exact same problem. I mistakenly added a new line in the core_cofig_data table while trying to insert some entries for something different. I'm using SequelPro app on Mac and when I add a new row it automatically adds general under path – Alex Dinca Feb 28 '17 at 20:16
  • 1
    yup, same issue for me a quick easy way to get rid of it for future reference:DELETE FROM core_config_data WHERE path LIKE 'general' AND value IS NULL LIMIT 1; – B00MER Mar 21 '17 at 8:41
  • Can confirm that this was the issue on M2 EE v 2.1.5. A clean install that was functioning until I installed uRapidFlow. Not sure if this is a Magento bug or if an issue with the extension. – sparecycle Apr 11 '17 at 20:16
  • u saved my day @giel – Sina Miandashti Jun 1 '17 at 6:55
  • 1
    It worked as a charm, and don't forget to clean cache after deleting the "general" "NULL" line in the database ;) – Alex Aug 14 '17 at 9:02
8

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.

  • I Have just revert back my old website by reverting backup .and we are working on deadline so I have not checked the issue which causing the issue But thank you for your answer. I have upvoted your answer and i will check If it is the same issue then I will Mark your answer as accepted – Murtuza Zabuawala Sep 8 '16 at 11:40
  • I faced this issue in a vanilla setup of 2.3.0 and solved it using above solution. Thanks @Siarhey – Praful Rajput Apr 11 at 10:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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