From 4d1a214836fc16bbecd5afd11060a56bc2859b7d Mon Sep 17 00:00:00 2001 From: Phil Sturgeon Date: Wed, 4 Jul 2012 13:45:46 +0200 Subject: Having `"0"` in an array would give you NULL with `elements()`. BAD! The trouble here, is that when we are expecting a valid result, such as `0`, or `false` that the array helper will instead say "I don't know if there is a value" and give you a `null`. --- system/helpers/array_helper.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'system') diff --git a/system/helpers/array_helper.php b/system/helpers/array_helper.php index 5d0243951..0dfc3e1ae 100644 --- a/system/helpers/array_helper.php +++ b/system/helpers/array_helper.php @@ -52,7 +52,7 @@ if ( ! function_exists('element')) */ function element($item, $array, $default = NULL) { - return empty($array[$item]) ? $default : $array[$item]; + return ! isset($array[$item]) ? $default : $array[$item]; } } -- cgit v1.2.3-24-g4f1b