Zend Framework

Zend_Date::setDate when parsing the date to set in an array

Details

  • Type: Bug Bug
  • Status: Resolved Resolved
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: None
  • Fix Version/s: 1.9.2
  • Component/s: Zend_Date
  • Labels:
    None

Description

Using Zend_Date::setDate with the date to set in an array throws an exception in Zend/Date.php, line 2846 due to the use of an undefined variable in the if clause.

The simple test below demonstrates the problem.

The expected result of this test is to pass, the actual result is a Zend_Date_Exception with the message "no day,month or year given in array".

public function testSetDateWithArray()
{
    $locale = new Zend_Locale('en-US');
    $date = new Zend_Date(1234567890, null, $locale);

    $array = array('year' => 2009, 'month' => 8, 'day' => 14);
    $result = $date->setDate($array, null, $locale);

    $this->assertSame('2009-08-14T04:31:30+05:00', $result->get(Zend_Date::W3C));
}

Activity

Hide
Björn Graf added a comment -

This patch contains a fix for the problem and the test to verify its correctness.

Show
Björn Graf added a comment - This patch contains a fix for the problem and the test to verify its correctness.
Hide
Thomas Weidner added a comment -

Fixed with r17607

Show
Thomas Weidner added a comment - Fixed with r17607

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: