ZF-8998: Zend_Locale::setDefault() fails to set default properly

Issue Type: Bug Created: 2010-01-28T08:54:32.000+0000 Last Updated: 2010-01-28T14:30:50.000+0000 Status: Resolved Fix version(s): - 1.10.1 (10/Feb/10)

Reporter: Mason Malone (masonm) Assignee: Thomas Weidner (thomas) Tags: - Zend_Locale

Related issues: Attachments: - test.php


When Zend_Locale::setDefault() is called, it internally calls self::_prepareLocale() with the given $locale, which then sets the static self::$_auto variable if it has not already been set. In setting self::$_auto, _prepareLocale() calls Zend_Locale::getDefault(), which returns the value of the PREVIOUS default (the one before setDefault() was called). Since the self::$_auto variable never changes once set, all subsequent calls to _prepapreLocale() will cause the old default to be used should it fall back to "auto". Thus, calling Zend_Locale::setDefault() has no effect on the default when "auto" is used.


Posted by Mason Malone (masonm) on 2010-01-28T08:59:01.000+0000

Here's some reproduction code.

Output I get (on Mac OS 10.2.0 with PHP 5.3.1): Setting locale to: C Setting default to de_DE Environment: array(0) { } This should be de_DE: en

Posted by Thomas Weidner (thomas) on 2010-01-28T14:30:50.000+0000

Agreed and solved with r20731 also when this is a real rare case

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.