From f2b614f41dab9515a3ffcce1bcc5dad6532da6b0 Mon Sep 17 00:00:00 2001 From: slothman Date: Tue, 19 Feb 2008 19:48:53 +0000 Subject: [PATCH] Modify pickKey to examine parent array before nested arrays. --- include/functions.inc.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/include/functions.inc.php b/include/functions.inc.php index 243546b..4571b40 100644 --- a/include/functions.inc.php +++ b/include/functions.inc.php @@ -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]; -- 2.39.5