Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
At line 2708 we find this call:
$replacement = format_date(strtotime($value['month'] . '/' . $value['day'] . '/' . $value['year']), 'custom', 'F j, Y', '0');
However this means we should use timezone '0' which does not exist. This argument should be omitted and become:
$replacement = format_date(strtotime($value['month'] . '/' . $value['day'] . '/' . $value['year']), 'custom', 'F j, Y', '0');
Else you will get these messages:
Warning: timezone_open() [function.timezone-open]: Unknown or bad timezone (0) in format_date() (line 1867 of /home/berend/src/ibmt/www/includes/common.inc). Warning: date_timezone_set() expects parameter 2 to be DateTimeZone, boolean given in format_date() (line 1905 of /home/berend/src/ibmt/www/includes/common.inc).
Comment | File | Size | Author |
---|---|---|---|
#2 | webform_date_token-d6.patch | 1.24 KB | quicksketch |
#2 | webform_date_token-d7.patch | 1.23 KB | quicksketch |
webform_format_date.patch | 762 bytes | berenddeboer | |
Comments
Comment #1
quicksketchThanks, though I'd say that the argument should be 'UTC', not omitted. In Drupal 6, "timezones" were expressed by numbers, so 0 in D6 == 'UTC' in D7. Omitting the option will use the server or user timezone.
Comment #2
quicksketchI've tested and committed the attached patch, which uses the relatively new Webform date functions to accomplish the same thing as this patch, but works consistently across D6 and D7.
Comment #4
carl.ben CreditAttribution: carl.ben commentedI get the same warnings using the latest version of Webform, after submitting a form:
Comment #5
quicksketch@carl.ben: Have you set your site-wide timezone?
Comment #6
carl.ben CreditAttribution: carl.ben commentedyes, it was set right after installation.
Comment #7
kevinsiji CreditAttribution: kevinsiji commentedSite default timezone is set, as well as the submitting user timezone also. Submission is success. The error is displayed while viewing the submission.
Warning: date_timezone_set() expects parameter 2 to be DateTimeZone, boolean given in format_date() (line 1937 of /var/www/html/mendies/includes/common.inc).
This error is repeating for each date field.
Version: 7.x-3.17
Comment #8
quicksketchI'm unable to reproduce this problem. If steps are provided to reproduce this problem from a fresh install I'll take another look.
Comment #9
quicksketchWe haven't had any confirming reports of this issue recently and I don't know how to reproduce the problem. Please reopen if this is still an issue and we have a way to reproduce it.
Comment #10
quicksketchOops, wrong category.