Issues

ZF-12456: Zend_Date API loses 7 hours from 18 Jan 2038 07:14 AM to 19 Jan 2038 02:15 PM

Issue Type: Bug Created: 2012-10-28T22:34:33.000+0000 Last Updated: 2013-04-05T16:07:12.000+0000 Status: Closed Fix version(s): Reporter: Harry Tarnz (hltla) Assignee: Thomas Weidner (thomas) Tags: - Zend_Date

  • zend_date

Related issues: Attachments:

Description

7 hours seem to "disappear" (actually, an earlier range of time is repeated) from 18 Jan 2038 07:14 AM to 19 Jan 2038 02:15 PM. We are in time zone Los Angeles, so we are GMT -7 hours, so we think that's where the problem arises. If we switch to time zone GMT, there is no such offset. We theorize (but have not checked) that other time zones may have similar problems.

The result of leaving such a condition in (whether the result of a bug or even by design) could mean the catastrophic failure of some IT systems in 25 years, around January 18-19, 2038. In fact, we have a mission critical system that would have eventually failed with significant consequences had we not tested for and uncovered this situation. (We are currently employing a workaround.)

EXAMPLE

This code:

$d = new Zend_Date('01/18/2038 07:14 PM'); echo $d . '
'; $d = new Zend_Date('01/18/2038 07:15 PM'); echo $d . '
'; $d = new Zend_Date('01/19/2038 02:14 AM'); echo $d . '
'; $d = new Zend_Date('01/19/2038 02:15 AM'); echo $d . '
';

produces this output:

Jan 18, 2038 7:14:00 PM Jan 18, 2038 12:15:00 PM Jan 18, 2038 7:14:00 PM Jan 19, 2038 3:15:00 AM

NOTES: 1. We would expect that any sequence of "$d = new Zend_Date('some date'); echo $d . '
';" would produce a result consistent with the input date string. 2. The "Jan 18, 2038 12:15:00 PM" should have been the minute after "7:14:00 PM", or "7:15:00 PM". Instead, it is seven hours earlier. 3. Similarly, the "Jan 18, 2038 7:14:00 PM" should have been the minute before "Jan 19, 2038 3:15:00 PM", or "Jan 19, 2038 3:14:00 PM". Instead, it is seven hours earlier. 4. The time range from "Jan 18, 2038 12:15:00 PM" to the same day at "7:14:00 PM" is repeated twice. 5. The issue probably doesn't occur exactly at seconds = 00, but the minute is the most discrete level of our test. 6. Also, on and after "Jan 19, 2038 3:15:00 AM", the time is now off by +1 hour.

We are currently using Zend Framework 2.3.0.

Thank you for the timesaving Zend and the wonderful Zend Date API. Good luck on the resolution.

Comments

Posted by Harry Tarnz (hltla) on 2012-10-28T22:35:20.000+0000

Corrected intro

Posted by Rob Allen (rob) on 2012-11-06T20:27:00.000+0000

Interestingly, I don't see this output on my system.

I get:

<pre class="highlight">
Jan 18, 2038 6:14:00 PM
Jan 18, 2038 6:15:00 PM
Jan 19, 2038 1:14:00 AM
Jan 19, 2038 1:15:00 AM

This feels like it's related to timezone handling somewhere.

Posted by Rob Allen (rob) on 2012-11-06T20:38:30.000+0000

Another data point:

<pre class="highlight">
date_default_timezone_set('Etc/GMT-7');
$d = new Zend_Date('01/18/2038 07:14 PM');
echo $d . PHP_EOL;
$d = new Zend_Date('01/18/2038 07:15 PM');
echo $d . PHP_EOL;
$d = new Zend_Date('01/19/2038 02:14 AM');
echo $d . PHP_EOL;
$d = new Zend_Date('01/19/2038 02:15 AM');
echo $d . PHP_EOL;

results in:

<pre class="highlight">
Jan 18, 2038 7:14:00 PM
Jan 18, 2038 7:15:00 PM
Jan 19, 2038 2:14:00 AM
Jan 19, 2038 2:15:00 AM

Posted by Harry Tarnz (hltla) on 2013-01-06T03:46:17.000+0000

We've isolated this issue to 32-bit stacks. 64-bit stacks seem to work fine, probably because the longer work stacks have longer default integer number sizes (i.e., 64-bit as opposed to the smaller 32-bit). One solution, if you see this issue, would be to move from a 32-bit to a 64-bit OS.

Posted by Frank Br├╝ckner (frosch) on 2013-01-06T16:18:11.000+0000

@Harry Thank you for the info!

Posted by Ralph Schindler (ralph) on 2013-04-05T16:07:12.000+0000

This issue has been closed on Jira and moved to GitHub for issue tracking. To continue following the resolution of this issues, please visit: https://github.com/zendframework/zf1/issues/28

Have you found an issue?

See the Overview section for more details.

Copyright

© 2006-2016 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.

Contacts