From eead674de14f77d79d99a54c9409e19c9fd7f04a Mon Sep 17 00:00:00 2001 From: azett Date: Tue, 23 Oct 2018 13:22:43 +0200 Subject: [PATCH] Bugfix in utils_array_kshift(): Didn't return NULL properly when array parameter is given empty or not an array --- fp-includes/core/core.utils.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/fp-includes/core/core.utils.php b/fp-includes/core/core.utils.php index 101b389..48121ec 100644 --- a/fp-includes/core/core.utils.php +++ b/fp-includes/core/core.utils.php @@ -431,6 +431,9 @@ function fplog($str) { * @return unknown the shifted value, or NULL if array is empty or is not an array */ function utils_array_kshift(&$arr) { + if (!is_array($arr) || count($arr) === 0) { + return null; + } list ($k) = array_keys($arr); $r = array( $k => $arr [$k]