]> git.mjollnir.org Git - s9y.git/commitdiff
Modify pickKey to examine parent array before nested arrays.
authorslothman <slothman>
Tue, 19 Feb 2008 19:48:53 +0000 (19:48 +0000)
committerslothman <slothman>
Tue, 19 Feb 2008 19:48:53 +0000 (19:48 +0000)
include/functions.inc.php

index 243546ba2d9b1a8f12adb68a58db9eb9963cd275..4571b40d6528db6c394bea351b7548975d3bb146 100644 (file)
@@ -1149,6 +1149,10 @@ function &serendipity_pickKey(&$array, $key, $default) {
         return $default;
     }
 
+    // array_key_exists() copies array, so is much slower.
+    if (in_array($key, array_keys($array))) {
+        return $array[$key];
+    }
     foreach($array AS $child) {
         if (is_array($child) && isset($child[$key]) && !empty($child[$key])) {
             return $child[$key];