WordPress.org

Make WordPress Core

Opened 4 years ago

Last modified 2 years ago

#38940 closed defect (bug)

current_time() expects that date_default_timezone_set is never used — at Initial Version

Reported by: marco.marsala Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.6.1
Component: Date/Time Keywords: has-patch dev-feedback 2nd-opinion
Focuses: Cc:

Description

Currently, the function current_time() expects date_default_timezone_set() is never used.

Inspecting the code of current_time() confirmed this, because it formats the result using date() function (that is affected by timezone).

In fact seems Wordpress always resets the timezone to UTC; an echo date_default_timezone_get(); placed at top and at bottom of wp-config.php in a clean WordPress setup will prove this.

So using date_default_timezone_set() anywhere in theme or plugin code will broke current_time().

Change History (0)

Note: See TracTickets for help on using tickets.