ZF-9889: Wrong test for exists locale

Description

Hi, i have problem with commit #22278. After this commit is generated WARNING:

Warning: array_key_exists() [function.array-key-exists]: The first argument should be either a string or an integer in /home/lestr/projekty/alarm-online/trunk/library/Zend/Locale.php on line 811

I think there is missing negation before calling is_array function.

This is svn diff from my local copy of releace branche

 
--- library/Zend/Locale.php     (revision 329)
+++ library/Zend/Locale.php     (working copy)
@@ -808,7 +808,7 @@
     public static function isLocale($locale, $strict = false, $compatible = true)
     {
         if (($locale instanceof Zend_Locale) 
-            || (is_array($locale) && array_key_exists($locale, self::$_localeData))
+            || (!is_array($locale) && array_key_exists($locale, self::$_localeData))
         ) {
             return true;
         }

Is this fix correct?

Comments

I don't know if it's the correct fix but I can confirm that there is a bug.

I think that should be:


     public static function isLocale($locale, $strict = false, $compatible = true)
     {
         if (($locale instanceof Zend_Locale) 
-            || (is_array($locale) && array_key_exists($locale, self::$_localeData))
+            || (is_string($locale) && array_key_exists($locale, self::$_localeData))
         ) {
             return true;
         }

Fixed by r22314