#17840 closed defect (bug) (fixed)
Fatal Error on General Settings when Timezone string is invalid.
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Milestone: | 3.2 | Priority: | high |
| Severity: | normal | Version: | 3.2 |
| Component: | Date/Time | Keywords: | i18n-change |
| Focuses: | Cc: |
Description
If an enterprising user manages to get an invalid value in this option the General Settings page is completely broken:
[19-Jun-2011 08:03:27] PHP Fatal error: Uncaught exception 'Exception' with message 'DateTimeZone::__construct() [<a href='datetimezone.--construct'>datetimezone.--construct</a>]: Unknown or bad timezone (Garbage)' in .../wp-admin/options-general.php:187Stack trace:
#0 .../wp-admin/options-general.php(187): DateTimeZone->__construct('Garbage')#1 {main}
thrown in .../wp-admin/options-general.php on line 187
Attachments (1)
Change History (7)
#1
@
15 years ago
Note with the above fix the user who has set the dodgy data still gets these Warnings and Notices:
WARNING: wp-includes/functions.php:4082 - timezone_open() [function.timezone-open]: Unknown or bad timezone (Garbage)
WARNING: wp-includes/functions.php:126 - timezone_open() [function.timezone-open]: Unknown or bad timezone (Garbage)
WARNING: wp-includes/functions.php:127 - date_create() expects parameter 2 to be DateTimeZone, boolean given
WARNING: wp-includes/functions.php:130 - date_format() expects parameter 1 to be DateTime, boolean given
NOTICE: wp-admin/options-general.php:176 - date_default_timezone_set() [function.date-default-timezone-set]: Timezone ID 'Garbage' is invalid
I would be happy to leave fixing these till 3.3 :)
#2
@
15 years ago
Also note in theory a valid timezone could become invalid in future if it disappears from the map :)
Note: See
TracTickets for help on using
tickets.
Fix the Fatal Error and sanitize the option on save in future