βMarch 25, 2012β was the date when the time was changed from 02:00 to 03:00 in the Czech Republic. On this day, one function on my website stopped working correctly, and the client complained, etc. After digging a few hours, I realized that Zend_Date was behaving strangely that day:
#!/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("jnY H:i", $startDate) . PHP_EOL; $date->set('23:59:00', Zend_Date::TIMES); $endDate = $date->get(Zend_Date::TIMESTAMP); echo 'end date: ' . date("jnY H:i", $endDate) . PHP_EOL;
It is output:
start date: 24.3.2012 23:01 end date: 24.3.2012 23:59
which is off during the day.
If I change the date to "March 26, 2012 12:00:00", it will correctly output:
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 this a bug in Zend_Date? I think this is the case, so I already posted a bug report http://framework.zend.com/issues/browse/ZF-12121 . But maybe I am missing something obvious?
clime source share