ZF-9085: Zend_Date#getMonth() breaks when using PHP date format mode

Issue Type: Bug Created: 2010-02-04T11:42:49.000+0000 Last Updated: 2010-02-05T14:37:04.000+0000 Status: Resolved Fix version(s): - 1.10.1 (10/Feb/10)

Reporter: Mark Haase (mehaase) Assignee: Thomas Weidner (thomas) Tags: - Zend_Date

Related issues: Attachments:


Just upgraded to 1.10.0 and found this regression.

To reproduce:

  1. Set Zend_Date's date format to 'php' 2) Create a new date object 3) Call getMonth() on that date object

Expected result:

Get a date object returned with the month set to the same month as the original date.

Actual result:

Zend_Date_Exception is thrown.

I will add more details in the comments.


Posted by Mark Haase (mehaase) on 2010-02-04T11:44:24.000+0000

Here's a quick test case. Sorry I'm not a regular developer for ZF, so I don't know what kinds of tests you usually submit. My test includes a bootstrap for my own project, but other than that it should be portable:

<pre class="highlight">

// This is our project bootstrap... sets up class loading, etc.
require_once(realpath(dirname(__FILE__) . '/FismaUnitTest.php'));

 * Zend_Date fails on getMonth() when the date format mode is 'php'
class ZfDateFailure extends PHPUnit_Framework_TestCase
    public function testGetMonth()
        Zend_Date::setOptions(array('format_type' => 'php'));
        $today = new Zend_Date();

Here are the test results:

<pre class="highlight">
/Users/mehaase/openfisma_trunk/tests $ phpunit ZfDateFailure.php
PHPUnit 3.4.4 by Sebastian Bergmann.


Time: 0 seconds

There was 1 error:

1) ZfDateFailure::testGetMonth
Zend_Date_Exception: No date part in 'MMMMMM' found.


Tests: 1, Assertions: 0, Errors: 1.

Posted by Thomas Weidner (thomas) on 2010-02-05T14:37:03.000+0000

Fixed with r20936

Have you found an issue?

See the Overview section for more details.


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