date_format() warning on line 356

Created on 21 July 2009, over 15 years ago
Updated 18 May 2023, over 1 year ago

This may be the same issue as #463052: warning: date_timezone_set() expects parameter 1 to be DateTime, null given but I'm getting the error on different code lines (which may or may not be because I'm using the latest devs). I thought it safer to open a new issue.

  • PHP 5.2.6
  • Drupal 6.13
  • CCK 6.x-2.x-dev July 21
  • Date 6.x-2.x-dev June 21
  • Mollom 6.x-1.9

On a fresh Drupal install, enable CCK and Date. Add a datetime field to the story content type, keep the field defaults. Submit a story as an authenticated user, it works perfectly.

Enable Mollom and set the story form to "Text analysis and CAPTCHA backup". Try to submit a story form, you'll get this warning:

warning: date_format() expects parameter 1 to be DateTime, null given in /var/www/vhosts/keeptrust.org/httpdocs/sites/all/modules/date/date/date.module on line 356.
warning: date_timezone_set() expects parameter 1 to be DateTime, null given in /var/www/vhosts/keeptrust.org/httpdocs/sites/all/modules/date/date/date.module on line 358.
warning: date_format() expects parameter 1 to be DateTime, null given in /var/www/vhosts/keeptrust.org/httpdocs/sites/all/modules/date/date/date.module on line 360.
warning: date_offset_get() expects parameter 1 to be DateTime, null given in /var/www/vhosts/keeptrust.org/httpdocs/sites/all/modules/date/date/date.module on line 362.

The node is created correctly.

Setting the form to "CAPTCHA only" makes the warning disappear.

🐛 Bug report
Status

Fixed

Version

1.0

Component

Code

Created by

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

No activities found.

Production build 0.71.5 2024