[wp-trac] [WordPress Trac] #10940: Default timezone should be set for PHP5

WordPress Trac wp-trac at lists.automattic.com
Wed Dec 2 21:08:39 UTC 2009


#10940: Default timezone should be set for PHP5
--------------------------+-------------------------------------------------
 Reporter:  Viper007Bond  |        Owner:        
     Type:  defect (bug)  |       Status:  closed
 Priority:  high          |    Milestone:  2.9   
Component:  Date/Time     |      Version:  2.9   
 Severity:  critical      |   Resolution:  fixed 
 Keywords:  has-patch     |  
--------------------------+-------------------------------------------------

Comment(by Otto42):

 Note: Patching in this manner will result in different results with
 various time function calls between PHP5 and PHP4 setups. It will also
 result in different results for the output of a time() call at various
 points in WP execution.

 Not that the patch is wrong (it's not), I'm just noting the fact for
 future reference.

 This makes it important for everybody to remember the difference between
 gmtime() and time() and other similar functions anywhere else in
 WordPress.

 If you want current UTC time, you '''must''' use gmtime() type functions.
 Normal time() functions are not guaranteed to give you any particular time
 settings, but will usually give you the adjusted local-time. The actual
 current local timezone won't get loaded until somebody tries to call
 wp_timezone_override_offset(), which happens pretty much anytime a
 WordPress time-related function gets called.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/10940#comment:19>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list