? sites/default/files
? sites/default/private
? sites/default/settings.php
Index: CHANGELOG.txt
===================================================================
RCS file: /cvs/drupal/drupal/CHANGELOG.txt,v
retrieving revision 1.329
diff -u -p -r1.329 CHANGELOG.txt
--- CHANGELOG.txt	19 Aug 2009 22:46:05 -0000	1.329
+++ CHANGELOG.txt	21 Aug 2009 23:26:28 -0000
@@ -76,6 +76,8 @@ Drupal 7.0, xxxx-xx-xx (development vers
     * If your site is being upgraded from Drupal 6 and you do not have the
       contributed date or event modules installed, user time zone settings will
       fallback to the system time zone and will have to be reconfigured by each user.
+    * User-configured time zones now serve as the default time zone for PHP
+      date/time functions.
 - Filter system:
     * Refactored the HTML corrector to take advantage of PHP 5 features.
 - Removed ping module:
Index: includes/bootstrap.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/bootstrap.inc,v
retrieving revision 1.299
diff -u -p -r1.299 bootstrap.inc
--- includes/bootstrap.inc	21 Aug 2009 00:00:43 -0000	1.299
+++ includes/bootstrap.inc	21 Aug 2009 23:26:28 -0000
@@ -1509,6 +1509,7 @@ function _drupal_bootstrap($phase) {
     case DRUPAL_BOOTSTRAP_SESSION:
       require_once DRUPAL_ROOT . '/' . variable_get('session_inc', 'includes/session.inc');
       drupal_session_initialize();
+      date_default_timezone_set(drupal_get_user_timezone());
       break;
 
     case DRUPAL_BOOTSTRAP_PAGE_HEADER:
@@ -1546,6 +1547,21 @@ function _drupal_bootstrap($phase) {
 }
 
 /**
+ * Return the time zone of the current user.
+ */
+function drupal_get_user_timezone() {
+  global $user;
+  if (variable_get('configurable_timezones', 1) && $user->uid && $user->timezone) {
+    return $user->timezone;
+  }
+  else {
+    // Ignore PHP strict notice if time zone has not yet been set in the php.ini
+    // configuration.
+    return variable_get('date_default_timezone', @date_default_timezone_get());
+  }
+}
+
+/**
  * Validate the HMAC and timestamp of a user agent header from simpletest.
  */
 function drupal_valid_test_ua($user_agent) {
Index: includes/common.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/common.inc,v
retrieving revision 1.965
diff -u -p -r1.965 common.inc
--- includes/common.inc	21 Aug 2009 07:50:07 -0000	1.965
+++ includes/common.inc	21 Aug 2009 23:26:32 -0000
@@ -1970,13 +1970,7 @@ function format_interval($timestamp, $gr
 function format_date($timestamp, $type = 'medium', $format = '', $timezone = NULL, $langcode = NULL) {
   $timezones = &drupal_static(__FUNCTION__, array());
   if (!isset($timezone)) {
-    global $user;
-    if (variable_get('configurable_timezones', 1) && $user->uid && $user->timezone) {
-      $timezone = $user->timezone;
-    }
-    else {
-      $timezone = variable_get('date_default_timezone', 'UTC');
-    }
+    $timezone = date_default_timezone_get();
   }
   // Store DateTimeZone objects in an array rather than repeatedly
   // contructing identical objects over the life of a request.
Index: includes/session.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/session.inc,v
retrieving revision 1.70
diff -u -p -r1.70 session.inc
--- includes/session.inc	1 Jul 2009 12:47:30 -0000	1.70
+++ includes/session.inc	21 Aug 2009 23:26:32 -0000
@@ -269,6 +269,7 @@ function drupal_session_regenerate() {
       ->condition('sid', $old_session_id)
       ->execute();
   }
+  date_default_timezone_set(drupal_get_user_timezone());
 }
 
 /**
Index: modules/simpletest/drupal_web_test_case.php
===================================================================
RCS file: /cvs/drupal/drupal/modules/simpletest/drupal_web_test_case.php,v
retrieving revision 1.140
diff -u -p -r1.140 drupal_web_test_case.php
--- modules/simpletest/drupal_web_test_case.php	21 Aug 2009 07:50:07 -0000	1.140
+++ modules/simpletest/drupal_web_test_case.php	21 Aug 2009 23:26:32 -0000
@@ -1106,6 +1106,7 @@ class DrupalWebTestCase extends DrupalTe
     variable_set('install_task', 'done');
     variable_set('clean_url', $clean_url_original);
     variable_set('site_mail', 'simpletest@example.com');
+    variable_set('date_default_timezone', date_default_timezone_get());
     // Set up English language.
     unset($GLOBALS['conf']['language_default']);
     $language = language_default();
Index: modules/simpletest/tests/common.test
===================================================================
RCS file: /cvs/drupal/drupal/modules/simpletest/tests/common.test,v
retrieving revision 1.65
diff -u -p -r1.65 common.test
--- modules/simpletest/tests/common.test	21 Aug 2009 14:28:52 -0000	1.65
+++ modules/simpletest/tests/common.test	21 Aug 2009 23:26:33 -0000
@@ -1240,6 +1240,8 @@ class FormatDateUnitTest extends DrupalW
     $user = user_load($test_user->uid, TRUE);
     $real_language = $language->language;
     $language->language = $user->language;
+    // Simulate a Drupal bootstrap with the logged-in user.
+    date_default_timezone_set(drupal_get_user_timezone());
 
     $this->assertIdentical(format_date($timestamp, 'custom', 'l, d-M-y H:i:s T', 'America/Los_Angeles', 'en'), 'Sunday, 25-Mar-07 17:00:00 PDT', t('Test a different language.'));
     $this->assertIdentical(format_date($timestamp, 'custom', 'l, d-M-y H:i:s T', 'Europe/London'), 'Monday, 26-Mar-07 01:00:00 BST', t('Test a different time zone.'));
@@ -1252,6 +1254,8 @@ class FormatDateUnitTest extends DrupalW
     // Restore the original user and language, and enable session saving.
     $user = $real_user;
     $language->language = $real_language;
+    // Restore default time zone.
+    date_default_timezone_set(drupal_get_user_timezone());
     drupal_save_session(TRUE);
   }
 }
Index: modules/user/user.test
===================================================================
RCS file: /cvs/drupal/drupal/modules/user/user.test,v
retrieving revision 1.56
diff -u -p -r1.56 user.test
--- modules/user/user.test	21 Aug 2009 14:27:47 -0000	1.56
+++ modules/user/user.test	21 Aug 2009 23:26:33 -0000
@@ -1008,11 +1008,12 @@ class UserTimeZoneFunctionalTest extends
 
     // Confirm date format and time zone.
     $this->drupalGet("node/$node1->nid");
-    $this->assertText('2007-03-10 02:00 CLST', t('Date should be Chile summer time; five hours ahead of PST.'));
+    $this->assertText('2007-03-10 02:00 CLST', t('Date should be Chile summer time; five hours ahead of PST.') . $this->drupalGet("node/$node1->nid"));
+
     $this->drupalGet("node/$node2->nid");
-    $this->assertText('2007-03-11 05:00 CLT', t('Date should be Chile time; four hours ahead of PST'));
+    $this->assertText('2007-03-11 05:00 CLT', t('Date should be Chile time; four hours ahead of PST') . $this->drupalGet("node/$node2->nid"));
     $this->drupalGet("node/$node3->nid");
-    $this->assertText('2007-03-21 00:00 CLT', t('Date should be Chile time; three hours ahead of PDT.'));
+    $this->assertText('2007-03-21 00:00 CLT', t('Date should be Chile time; three hours ahead of PDT.') . $this->drupalGet("node/$node3->nid"));
   }
 }
 
