When a user enters a date prior to January 1, 1970 (e.g. before the start of the Unix epoch), the e-mail which is sent when the form is submitted shows the date as "Jan 1, 1970". This is because the formatting code in date.inc uses strtotime(), which has undefined behaviour for dates earlier than the start of the Unix epoch.

This patch keeps the existing strtotime() formatting behaviour for dates on or after January 1, 1970. For dates earlier than this, the strtotime() formatting is skipped and the raw values (month number, day number, and year number) are included in the e-mail.

CommentFileSizeAuthor
date-pre1970.patch591 bytesatipton

Comments

quicksketch’s picture

Status: Needs review » Closed (won't fix)

This problem has been fixed in PHP 5.1 and higher. Since PHP4 is officially dead (as of 12-31-2007), this exception should no longer be an issue.

The PHP development team hereby announces that support for PHP 4 will continue until the end of this year only. After 2007-12-31 there will be no more releases of PHP 4.4. We will continue to make critical security fixes available on a case-by-case basis until 2008-08-08. Please use the rest of this year to make your application suitable to run on PHP 5.

geerlingguy’s picture

Version: » 6.x-2.x-dev
Status: Closed (won't fix) » Active

I'm using PHP 5.2.14 on my server (4.x isn't even installed, nor is 5.1.x), and I'm still getting all pre-1970 dates converted to "January 1, 1970" in the notification emails. However, the date displays correctly (as the user has submitted it) on the website.

I haven't tested this on the 3.x branch.

I'm running CentOS 5.5, Apache 2.x, PHP 5.2.14.

(For my internal tracking: http://archstldev.com/node/735).

quicksketch’s picture

Status: Active » Closed (won't fix)

I cannot confirm this problem on 3.x. 2.x is no longer supported.