Issues

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

Issue Type: Bug Created: 2009-08-13T16:04:24.000+0000 Last Updated: 2009-08-14T14:56:14.000+0000 Status: Resolved Fix version(s): - 1.9.2 (25/Aug/09)

Reporter: Björn Graf (bjoern) Assignee: Thomas Weidner (thomas) Tags: - Zend_Date

Related issues: Attachments: - Zend_Date.setDate-with-array.patch

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".

<pre class="highlight">
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));
}

Comments

Posted by Björn Graf (bjoern) on 2009-08-13T16:06:04.000+0000

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

Posted by Thomas Weidner (thomas) on 2009-08-14T14:55:07.000+0000

Fixed with r17607

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