From f76f91d9075259d11d8ad7c06795ead39e24d4a4 Mon Sep 17 00:00:00 2001 From: Janusz Dobrowolski Date: Tue, 11 May 2010 11:26:43 +0000 Subject: [PATCH] Fix in array_search_keys --- includes/current_user.inc | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/includes/current_user.inc b/includes/current_user.inc index 017a5405..c4d94539 100644 --- a/includes/current_user.inc +++ b/includes/current_user.inc @@ -481,12 +481,13 @@ function array_search_value($needle, $haystack, $valuekey=null) function array_search_keys($needle, $haystack, $valuekey=null) { $keys = array(); - foreach($haystack as $key => $value) { - $val = isset($valuekey) ? $value[$valuekey] : $value; - if ($needle == $val){ - $keys[] = $key; + if($haystack) + foreach($haystack as $key => $value) { + $val = isset($valuekey) ? $value[$valuekey] : $value; + if ($needle == $val){ + $keys[] = $key; + } } - } return $keys; } // -- 2.30.2