[buddypress-trac] [BuddyPress Trac] #5781: strtotime() is evil don't use it

buddypress-trac noreply at wordpress.org
Wed Aug 10 19:03:01 UTC 2016


#5781: strtotime() is evil don't use it
--------------------------+------------------------------
 Reporter:  r-a-y         |       Owner:
     Type:  defect (bug)  |      Status:  closed
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Core          |     Version:
 Severity:  normal        |  Resolution:  invalid
 Keywords:  has-patch     |
--------------------------+------------------------------
Changes (by r-a-y):

 * milestone:   => Awaiting Review


Comment:

 Sorry for missing this ticket update.

 What this ticket is trying to fix is redundant `strtotime()` calls and
 inconsistencies with time parsing.

 `03.patch` implements the redundant `strtotime()` calls by replacing
 `strtotime( bp_core_current_time() )` with `bp_core_current_time( true,
 'timestamp' )` because as noted in the ticket description:

 > strotime() is unnecessary since we use gmmktime() in
 bp_core_time_since(). See line 795:
 > https://buddypress.trac.wordpress.org/browser/tags/2.0.1/bp-core/bp-
 core-functions.php#L792

 ----

 As for the inconsistencies with time parsing, I still think altering all
 our `strtotime()` calls to add `+0000` would be safer.  WordPress does the
 same thing (see comment:4).

 Here's the main takeaway, all our `strtotime()` calls assume that GMT is
 the default timezone.

 In the documentation for `strtotime()`, this is what is stated:

 > Each parameter of this function '''uses the default time zone unless a
 time zone is specified''' in that parameter. Be careful not to use
 different time zones in each parameter unless that is intended. (emphasis
 added)

--
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/5781#comment:10>
BuddyPress Trac <http://buddypress.org/>
BuddyPress Trac


More information about the buddypress-trac mailing list