Zend Framework

Zend_Locale::setDefault throws Exception with broken string

Details

  • Type: Bug Bug
  • Status: Resolved Resolved
  • Priority: Minor Minor
  • Resolution: Fixed
  • Affects Version/s: 1.9.0
  • Fix Version/s: 1.9.1
  • Component/s: Zend_Locale
  • Labels:
    None

Description

When providing an invalid locale code (for instance "en-US" instead of "en_US"), Zend_Locale::setDefault throws the exception with text "Unknown locale 'Array' can not be set as default!".

It should state the unknown locale to pinpoint the issue.

$locale = explode('_', (string) $locale); // $locals now contains an array
            
if (isset(self::$_localeData[$locale[0]]) === true) {
  self::$_default = array($locale[0] => $quality);
} else {
  require_once 'Zend/Locale/Exception.php';
  throw new Zend_Locale_Exception("Unknown locale '" . (string) $locale . "' can not be set as default!"); // casting array to string results in "Array"
}

Activity

Hide
Thomas Weidner added a comment -

Fixed with r17478

Show
Thomas Weidner added a comment - Fixed with r17478

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: