Details
Description
Given the following code example to reproduce:
date_default_timezone_set('Europe/Berlin');
$dt = array(
'year' => '2009',
'month' => '01',
'day' => '28',
'hour' => '23',
'minute' => '30',
'second' => '00'
);
$zd = new Zend_Date($dt);
echo $zd->toString("Y M d H m s");
// Expected: 2009 1 28 23 30 00
// Result: 2009 1 29 23 30 00
Tracing trough Zend/Date.php @ 214
// DST fix if ((is_array($date) === true) and (isset($date['hour']) === true)) { $hour = $this->toString('H'); $hour = $date['hour'] - $hour; if ($hour !== 0) { $this->addTimestamp($hour * 3600); } }
In the above code block, the first assignment to $hour sets it to 0;
The second assignment sets it to 23.
The conditional statement then adds 23 hours to the date instance.
I'm not sure what was intended here, but any DST correction should never exceed 1 hour.
Saving incorrectly resolved Zend_Date output may lead to (subtle) data loss.