ZF-11324: Example in docs throws a warning in constructor on PHP 5.3

Description

The following example from official docu-site 0 ends up with a php-warning:

Code: $d = new \Zend_Date('13.04.2006', array('date_format' => 'dd.MM.yyyy'));

Warning: defined() expects parameter 1 to be string, array given in /usr/share/php/libzend-framework-php/Zend/Date.php on line 155

After studying the source code, i think the documentation is not right at this point.

The following example works perfectly:

$d = new \Zend_Date('13.04.2006', 'dd.MM.yyyy');

it seems for me, the date-format must be a string, an array with named options is not wanted here.

So only the documentation should be changed. Regards, Hagen

php -v

PHP 5.3.2-1ubuntu4.7 with Suhosin-Patch (cli) (built: Jan 12 2011 18:36:55) Copyright (c) 1997-2009 The PHP Group Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies with Xdebug v2.0.5, Copyright (c) 2002-2008, by Derick Rethans with Suhosin v0.9.29, Copyright (c) 2007, by SektionEins GmbH

Zend-Version: 1.10.3

Comments

After studying the source code, i think the documentation is not right at this point (link was postet in the issue-body).

The following example works perfectly:

$d = new \Zend_Date('13.04.2006', 'dd.MM.yyyy');

it seems for me, the date-format must be a string, an array with named options is not wanted here.

So only the documentation should be changed. Regards, Hagen

The attached docu page is from Zend_Locale and not from Zend_Date. The given parameters work for Zend_Locale but for Zend_Date only the first parameter is allowed to be an array.

Hi Thomas, thanx for reply.

you're right, but the docu has still the wrong example code using an array as second parameter for Zend_Date (and this is the point i told you from):

Line 7: $dateObject = Zend_Date('13.04.2006', array('date_format' => 'dd.MM.yyyy'));

Changing issue type from "bug" to "docs problem"

Fixed on trunk (25220) and release-1.12 (25221)