"25 Mar 2012" was the date when time was changed from 02:00am to 03:00am in the Czech Republic. On that date, one functionality on my website stopped working correctly and a customer complained, etc. After digging for a few hours, I figured out that on that day Zend_Date behaved strangely:
#!/usr/bin/env php
<?php
include 'Zend/Date.php';
date_default_timezone_set('Europe/Prague');
shell_exec('sudo date --set="25 Mar 2012 12:00:00"');
$date = new Zend_Date();
$date->set('00:01:00', Zend_Date::TIMES);
$startDate = $date->get(Zend_Date::TIMESTAMP);
echo 'start date: ' . date("j.n.Y H:i", $startDate) . PHP_EOL;
$date->set('23:59:00', Zend_Date::TIMES);
$endDate = $date->get(Zend_Date::TIMESTAMP);
echo 'end date: ' . date("j.n.Y H:i", $endDate) . PHP_EOL;
This outputs:
start date: 24.3.2012 23:01
end date: 24.3.2012 23:59
which is off by day.
If I change the date to "26 Mar 2012 12:00:00", it correctly outputs:
start date: 26.3.2012 00:01
end date: 26.3.2012 23:59
Using mktime instead of Zend_Date works correctly in both cases. Is it bug in Zend_Date? I think it is, so I have already posted a bug report http://framework.zend.com/issues/browse/ZF-12121. But maybe I am missing something obvious?