Page MenuHomePhabricator

Show user a human readable message when $wgLocaltimezone is set to an invalid timezone
Closed, ResolvedPublicBUG REPORT

Assigned To
Authored By
Novem_Linguae
Nov 20 2024, 9:44 PM
Referenced Files
F57756845: image.png
Nov 28 2024, 7:43 PM
F57756837: image.png
Nov 28 2024, 7:43 PM
F57726286: image.png
Nov 20 2024, 10:57 PM
F57726291: image.png
Nov 20 2024, 10:57 PM
F57726289: image.png
Nov 20 2024, 10:57 PM

Description

Steps to replicate the issue (include links if applicable):

  • Add $wgLocaltimezone = 'America/New York'; to LocalSetting.php (note the space not underscore, this will trigger an error)
  • Load a page on your wiki

What happens?:

  • Depending on your error reporting settings, either an error 500 with no information, or
Fatal error: Uncaught Exception: DateTimeZone::__construct(): Unknown or bad timezone (America/New York) in /var/www/html/w/includes/MainConfigSchema.php:5122 Stack trace: #0 /var/www/html/w/includes/MainConfigSchema.php(5122): DateTimeZone->__construct() #1 /var/www/html/w/includes/Settings/DynamicDefaultValues.php(92): MediaWiki\MainConfigSchema::getDefaultLocalTZoffset() #2 /var/www/html/w/includes/Settings/DynamicDefaultValues.php(37): MediaWiki\Settings\DynamicDefaultValues->computeDefaultFor() #3 /var/www/html/w/includes/Setup.php(259): MediaWiki\Settings\DynamicDefaultValues->applyDynamicDefaults() #4 /var/www/html/w/includes/WebStart.php(85): require_once('...') #5 /var/www/html/w/index.php(50): require('...') #6 {main} thrown in /var/www/html/w/includes/MainConfigSchema.php on line 5122

What should have happened instead?:

  • Human readable message such as "Invalid timezone specified for $wgLocaltimezone. Please see the list of valid timezones at https://www.php.net/timezones. Please note that you should use underscores, not spaces."

Software version (on Special:Version page; skip for WMF-hosted wikis like Wikipedia):

Other information (browser name/version, screenshots, etc.):

Event Timeline

There doesn't appear to be a standard way to handle errors before the skin is loaded. Lots of variation.

Unformatted:

image.png (2,558×1,181 px, 421 KB)

Bad extension:

image.png (2,117×1,018 px, 196 KB)

Bad default skin:

image.png (2,521×1,188 px, 174 KB)

Change #1093977 had a related patch set uploaded (by AS1100K; author: AS1100K):

[mediawiki/core@master] Show user a human readable message when $wgLocaltimezone is set to an invalid timezone

https://gerrit.wikimedia.org/r/1093977

Change #1094167 had a related patch set uploaded (by AS1100K; author: AS1100K):

[mediawiki/core@master] Show user a human readable message when $wgLocaltimezone is set to an invalid timezone

https://gerrit.wikimedia.org/r/1094167

Change #1093977 abandoned by AS1100K:

[mediawiki/core@master] Show user a human readable message when $wgLocaltimezone is set to an invalid timezone

Reason:

A new patch is at https://gerrit.wikimedia.org/r/c/mediawiki/core/+/1094167 I am new to gerrit and messed up with Change-Id. Sorry!

https://gerrit.wikimedia.org/r/1093977

Change #1094167 merged by jenkins-bot:

[mediawiki/core@master] Show user a human readable message when $wgLocaltimezone is set to an invalid timezone

https://gerrit.wikimedia.org/r/1094167

Old:

image.png (2,546×282 px, 120 KB)

New:

image.png (2,525×329 px, 127 KB)

Still shows a stack trace, which may be a bit confusing to folks that don't know how to program. However it's an improvement since it now mentions $wgLocaltimezone, and links to the timezone allow list.

This can also be a Debian 13 support issue, some MW installations may have had $wgLocaltimezone set to deprecated values like PRC by the installer or manually. After they upgrade to Debian 13, the tzdata package no longer provides these timezones, and the tzdata-legacy package is not to be installed by default.

So I think it would be nice to backport the patch to supported branches.

Change #1174456 had a related patch set uploaded (by Func; author: AS1100K):

[mediawiki/core@REL1_43] Show user a human readable message when $wgLocaltimezone is set to an invalid timezone

https://gerrit.wikimedia.org/r/1174456

Change #1174458 had a related patch set uploaded (by Func; author: AS1100K):

[mediawiki/core@REL1_39] Show user a human readable message when $wgLocaltimezone is set to an invalid timezone

https://gerrit.wikimedia.org/r/1174458

Change #1174458 merged by jenkins-bot:

[mediawiki/core@REL1_39] Show user a human readable message when $wgLocaltimezone is set to an invalid timezone

https://gerrit.wikimedia.org/r/1174458

Change #1174456 merged by jenkins-bot:

[mediawiki/core@REL1_43] Show user a human readable message when $wgLocaltimezone is set to an invalid timezone

https://gerrit.wikimedia.org/r/1174456