[wp-trac] [WordPress Trac] #25365: timeAgo attribute for revisions produces the wrong result due to missing UTC in strtotime

WordPress Trac noreply at wordpress.org
Wed Mar 12 16:16:22 UTC 2014


#25365: timeAgo attribute for revisions produces the wrong result due to missing
UTC in strtotime
--------------------------+------------------------------
 Reporter:  biranit       |       Owner:
     Type:  defect (bug)  |      Status:  closed
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Revisions     |     Version:  3.6.1
 Severity:  normal        |  Resolution:  worksforme
 Keywords:                |     Focuses:
--------------------------+------------------------------
Changes (by adamsilverstein):

 * status:  new => closed
 * resolution:   => worksforme


Comment:

 Based on @nacin's
 [https://core.trac.wordpress.org/ticket/25365?replyto=2#comment:4
 comment], I'm guessing you were experiencing some sort of server
 configuration issue - possibly the server time was not set correctly? In
 all of our testing of this feature we never saw the time difference issue
 you mention.

 I'm going to close this ticket for now because I am unable to reproduce
 the problem, and it looks like a configuration error. If you are still
 seeing the issue, feel free to re-open the ticket and please provide some
 more details - steps to reproduce the issue and screenshots would be
 helpful.

 Thanks for the report, happy to work on fixing this if I can reproduce it.

 Replying to [comment:2 biranit]:
 > I went through ALL instances where strtotime is used in Wordpress 3.6.1
 and found two - possibly three - instances where this error should also be
 fixed:
 >
 > 1) In '''/wp-includes/comment.php line 2047''':
 >
 >
 > {{{
 > if ( time() - strtotime( $posts[0]->post_date_gmt ) > ( $days_old *
 DAY_IN_SECONDS ) ) {
 > }}}
 >
 > should be changed to
 >
 >
 > {{{
 > if ( time() - strtotime( $posts[0]->post_date_gmt . " UTC" ) > (
 $days_old * DAY_IN_SECONDS ) ) {
 > }}}
 >
 > 2) In '''/wp-includes/media.php lines 1661-1662''':
 >
 >
 > {{{
 > 'date'        => strtotime( $attachment->post_date_gmt ) * 1000,
 > 'modified'    => strtotime( $attachment->post_modified_gmt ) * 1000,
 >
 > }}}
 >
 > Should be changed to
 >
 >
 > {{{
 > 'date'        => strtotime( $attachment->post_date_gmt . " UTC") * 1000,
 > 'modified'    => strtotime( $attachment->post_modified_gmt . " UTC") *
 1000,
 > }}}
 >
 > 2) In '''/wp-content/plugins/akismet/akismet.php line 385''':
 >
 >
 > {{{
 > $last_updated = strtotime( $post->post_modified_gmt );
 > }}}
 >
 > Should be changed to
 >
 >
 > {{{
 > $last_updated = strtotime( $post->post_modified_gmt . " UTC");
 > }}}
 >
 > Thank you

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


More information about the wp-trac mailing list