Issues

ZF-7456: Regression in 1.9 in ability to create Zend_Date from array

Description

According to the reference manual, dates can be created in Zend_Date using an array: 14.5.3. Create Dates from an Array

This was the case in the 1.8 branch, but it doesn't seem to work for me in 1.9:


$mydate = new Zend_Date(array(
  'year'=>2008,
  'month'=>3,
  'day'=>1)
);

var_dump($mydate->toString());

//ZF 1.8.4 (latest from 1.8 svn branch): string 'Mar 1, 2008 12:00:00 AM' (length=23)
//ZF 1.9 (latest from 1.9 svn branch): string 'Feb 29, 2008 11:00:00 PM' (length=24)

Comments

This regression was introduced in revision 15909 which specifies it was a "fix for a Redhat only problem ".

I am noticing this problem on an Ubuntu Server.

Also, just in case this is server specific, it occurs for me on:

Ubuntu Server 9.04 (running kernel 2.6.28-13) with PHP 5.2.6

As best I can tell, the result of revision 15909 was that a different unixTimeStamp is set in the default date object. This changes the default date parts from 1/1/1970 to 12/31/1969, which then messes up the subsequent setting of date parts.

Reversing 15909 fixes this problem for me, although I suppose it creates different problems again for Red Hat Server users. Ultimately the problem is probably not 15909 but code somewhere else, although I'm not familiar enough with Zend_Date to be sure where.

Same problem here. Guess this asks for a quick fix (if necessary revert r15909?)

Fixed with r17613