[wp-trac] [WordPress Trac] #49120: strtotime() in WP::send_headers()

WordPress Trac noreply at wordpress.org
Fri Jan 3 02:18:06 UTC 2020


#49120: strtotime() in WP::send_headers()
-------------------------------+------------------------------
 Reporter:  autotutorial       |       Owner:  (none)
     Type:  defect (bug)       |      Status:  new
 Priority:  normal             |   Milestone:  Awaiting Review
Component:  Date/Time          |     Version:
 Severity:  normal             |  Resolution:
 Keywords:  reporter-feedback  |     Focuses:
-------------------------------+------------------------------

Comment (by autotutorial):

 Hi thanks for your welcome.
 It is a logical bug that does not reflect the current WordPress 5.3
 wp_date coding and other related functions do not use functions dependent
 on the current offset (all old php functions use the current offset except
 gmdate, gmmktime for it is 0).
 Before WordPress 5.3 it was used current_time with strtotime or date but
 it created problems for this it has been replaced by wp_date,
 current_datetime (DateTime class).
 An example of code follows, I was unable to create the bug but it would be
 nice to use the same code for each context.
 {{{#!php
 <?php
 $date = '2020-02-01 00:00';
 //plugin
 date_default_timezone_set('Australia/Adelaide');
 //ini_set( 'date.timezone', 'Australia/Adelaide');
 $timestamp[] = strtotime( $date );
 $offset = date( "Z" );
 $value = current( $timestamp );
 //Always UTC
 $timestamp[] = $value + $offset;
 //WordPress core #maybe
 date_default_timezone_set('UTC');
 //ini_set( 'date.timezone', 'UTC');
 $timestamp[] = strtotime( $date );
 var_dump( $timestamp );
 }}}

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


More information about the wp-trac mailing list