Zend Framework

Zend_Locale::setDefault() fails to set default properly

Details

  • Type: Bug Bug
  • Status: Resolved Resolved
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 1.10.0
  • Fix Version/s: 1.10.1
  • Component/s: Zend_Locale
  • Labels:
    None

Description

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.

Activity

Hide
Mason Malone added a comment -

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

Show
Mason Malone added a comment - 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
Hide
Thomas Weidner added a comment -

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

Show
Thomas Weidner added a comment - Agreed and solved with r20731 also when this is a real rare case

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: