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

Description

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.

Comments

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:


<?php

// 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();
        
        $today->getMonth();
    }
}

Here are the test results:


/Users/mehaase/openfisma_trunk/tests $ phpunit ZfDateFailure.php
PHPUnit 3.4.4 by Sebastian Bergmann.

E

Time: 0 seconds

There was 1 error:

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

/Users/mehaase/openfisma_trunk/library/Zend/Date.php:2659
/Users/mehaase/openfisma_trunk/library/Zend/Date.php:1075
/Users/mehaase/openfisma_trunk/library/Zend/Date.php:1174
/Users/mehaase/openfisma_trunk/library/Zend/Date.php:3577
/Users/mehaase/openfisma_trunk/tests/ZfDateFailure.php:17

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

Fixed with r20936