[wp-trac] [WordPress Trac] #38940: current_time() expects that date_default_timezone_set is never used
WordPress Trac
noreply at wordpress.org
Fri Nov 25 09:16:34 UTC 2016
#38940: current_time() expects that date_default_timezone_set is never used
---------------------------+-----------------------------
Reporter: marco.marsala | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Date/Time | Version: 4.6.1
Severity: normal | Keywords:
Focuses: |
---------------------------+-----------------------------
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()`.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/38940>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list