[wp-trac] [WordPress Trac] #40653: Use PHP `DateTime` class API in `current_time()`

WordPress Trac noreply at wordpress.org
Mon May 8 21:12:51 UTC 2017


#40653: Use PHP `DateTime` class API in `current_time()`
----------------------------------------+------------------------------
 Reporter:  jdgrimes                    |       Owner:
     Type:  enhancement                 |      Status:  new
 Priority:  normal                      |   Milestone:  Awaiting Review
Component:  Date/Time                   |     Version:  1.0
 Severity:  normal                      |  Resolution:
 Keywords:  has-patch needs-unit-tests  |     Focuses:
----------------------------------------+------------------------------

Comment (by jdgrimes):

 [attachment:40653.2.diff] avoids using `DateTimeZone` with the offsets.
 This has the effect of making the patch seem much more complex. Although
 some of the complexity was just previously hidden in
 `wp_timezone_override_offset()`. Still, I am questioning whether this
 entire proposal is worth it. Perhaps it would be better to revisit in
 2029, when PHP 5.5 is the minimum version supported by WordPress? I
 suppose though, that some of the bugs in `current_time()` are really best
 fixed in this manner, so the added complexity is just the price paid for
 legacy mistakes.

 The patch also ensures that an int is returned when a timestamp is
 requested, which the previous patches neglected to do.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/40653#comment:7>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list