updating my site to current date api 2,
i get these errors when i display a calendar block showing event.module events.

# warning: date_timezone_set() expects parameter 2 to be DateTimeZone, null given in /www/htdocs/konzep/z/sites/all/modules/calendar/calendar.inc on line 628.
# warning: date_timezone_set() expects parameter 2 to be DateTimeZone, null given in /www/htdocs/konzep/z/sites/all/modules/calendar/calendar.inc on line 629.

the offending codeblock is:

<?php
                  $timezone = calendar_event_timezone($node->event_timezone);
                  date_timezone_set($node->calendar_start_date, $timezone);
                  date_timezone_set($node->calendar_end_date, $timezone);
?>

with

<?php
/**
 * Get the timezone name from an Event module timezone zid.
 */
function calendar_event_timezone($zid) {
  static $timezones;
  if (empty($timezones)) {
    // The array that maps event timezone zids to timezone names is in
    // date_php4_tz_map.inc, need to reverse it so the zid is the key.
    include_once(drupal_get_path('module', 'date_php4') .'/date_php4_tz_map.inc');
    $timezones = array('' => '');
    $map = $timezone_map;
    foreach ($map as $zone => $values) {
      if (!empty($values['zid'])) {
        $timezones[$values['zid']] = $zone;
      }
    }
  }
  return $timezones[$zid];
}
?>

some debugging tells me that $zid = 314
and $timezones:

(
[] => {empty string}
[303] => US/Hawaii
[313] => US/Alaska
[308] => Etc/GMT-4
[306] => Etc/GMT-2
[307] => Etc/GMT-3
[310] => US/Central
[309] => US/Michigan
[311] => US/Mountain
[312] => US/Pacific
[302] => Etc/GMT-1
[143] => Canada/Newfoundland
[304] => US/Samoa
[305] => Etc/GMT-12
[486] => Pacific/Marquesas
)

this is not enough.
HOOPS, in date_php4_tz_map.inc many entries for zid are zero. this should not be.

changing "my" timezone to 314 solves the issue for me,
after apoplying #235434: warning: date_format() expects parameter 1 to be DateTime, null given also

Comments

KarenS’s picture

Status: Active » Fixed

This function is not in the latest code because we don't try to support Event dates any more. The many missing zids are straight from the Event module which never had any timezone info about those zones.

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.