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


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.


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

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