ZF-3779: Zend_Locale : some methods accept object or string and are not properly coded

Issue Type: Bug Created: 2008-07-28T08:46:27.000+0000 Last Updated: 2008-09-02T10:39:07.000+0000 Status: Resolved Fix version(s): - 1.6.0 (02/Sep/08)

Reporter: julien PAULI (doctorrock83) Assignee: Thomas Weidner (thomas) Tags: - Zend_Locale

Related issues: Attachments:


Zend_Locale's constructor docblock says

<pre class="highlight">
@param  string $locale (Optional) Locale for parsing input

The constructor looks for a string, but also looks for a Zend_Locale object to call its toString() method. The docblock should reflect that fact.

Same (revert) for the setDefault() method, docblock says

<pre class="highlight">
@param  string|Zend_Locale $locale Locale to set

But this time, the method doesn't accept a Zend_Locale object as param, it should ( calling its toString() method).


Posted by Thomas Weidner (thomas) on 2008-07-28T09:36:05.000+0000

Just because the Docblock is wrong, you can not say that the complete class is coded wrong :-) I think this is a hard word ;-)

Related to your second example you are wrong. Looking at the code you can see that the locale is casted to a string which does exactly the same as calling toString but is a little more performant.

I will correct the docblock.

Posted by julien PAULI (doctorrock83) on 2008-07-28T09:48:11.000+0000

I did not say the complete class is wrong, perhaps my english sentence meant that, so I apologyze :-D

For my second example, I'm sorry I'm right, I'm really talking about setDefault() method, not the setLocale() method ( whitch effectively casts to string like you say )

Posted by Thomas Weidner (thomas) on 2008-07-28T11:47:43.000+0000

Fixed with r10510

Posted by Wil Sinclair (wil) on 2008-09-02T10:39:07.000+0000

Updating for the 1.6.0 release.

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.