Closed (won't fix)
Project:
Date
Version:
5.x-1.5
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
8 May 2007 at 22:48 UTC
Updated:
31 Jan 2008 at 07:33 UTC
I noticed this bug when trying to debug an issue in the token module (http://drupal.org/node/114610) where date_make_date() is called with only a $value argument. Looking at the code of date.inc, it seems that the problem lies in date_set_date(). At line 347, there is the following logic:
elseif (!$error && $type == 'db' && $date->local->iso && (!$date->local->iso || $reset))
if (!date_no_conversion($date)) {
// compute local value if the db value was submitted
// and the local value has not been created and there is a local timezone
date_convert_timezone($date, 'GMT', $date->local->timezone, 'local');
}
else {
$date->local = $date->db;
}
For a new date $date->local->iso will not be set. So neither $date->local nor $date->db will be set. Note that this contrasts with the logic when the $type='local':
if (!$error && $type == 'local' && (!$date->db->iso || $reset))
In the attached patch, I convert the logic for $type='db' to be the mirror image of the logic for $type='local'.
But maybe I'm missing something subtle!
| Comment | File | Size | Author |
|---|---|---|---|
| date_set_date.patch | 725 bytes | egfrith |
Comments
Comment #1
karens commentedThis function is gone in 5.2 and all the code has been completely re-worked to use the PHP 5.2 methods to create and alter dates.
Comment #2
karens commentedI guess won't fix is more accurate -- won't apply this patch but the underlying problem is fixed.