ZF-7500: Zend_Locale::setDefault throws Exception with broken string

Issue Type: Bug Created: 2009-08-06T02:45:13.000+0000 Last Updated: 2009-08-09T01:18:45.000+0000 Status: Resolved Fix version(s): - 1.9.1 (11/Aug/09)

Reporter: Tobias (shnapoo) Assignee: Thomas Weidner (thomas) Tags: - Zend_Locale

Related issues: Attachments:


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.

<pre class="highlight">$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"


Posted by Thomas Weidner (thomas) on 2009-08-09T01:18:31.000+0000

Fixed with r17478

Have you found an issue?

See the Overview section for more details.


© 2006-2018 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.