From 28625e5bc99c59f90db117ecfddf5533db11c61e Mon Sep 17 00:00:00 2001 From: Joshua Logsdon Date: Tue, 24 Mar 2015 14:33:21 -0400 Subject: array_fill() throws an error if count($var) is 0 Signed-off-by: Joshua Logsdon --- system/core/Common.php | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'system') diff --git a/system/core/Common.php b/system/core/Common.php index ee5a705b2..935c687ab 100644 --- a/system/core/Common.php +++ b/system/core/Common.php @@ -743,6 +743,12 @@ if ( ! function_exists('html_escape')) { if (is_array($var)) { + // If empty array, skip escaping + if ( empty($var) ) + { + return $var; + } + return array_map('html_escape', $var, array_fill(0, count($var), $double_encode)); } -- cgit v1.2.3-24-g4f1b From 993e340a9a0e00c5a2cdbbfc47f0c8a24e8e4bf1 Mon Sep 17 00:00:00 2001 From: Joshua Logsdon Date: Wed, 25 Mar 2015 12:03:43 -0400 Subject: Return empty $var immediately Signed-off-by: Joshua Logsdon --- system/core/Common.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'system') diff --git a/system/core/Common.php b/system/core/Common.php index 935c687ab..2b1e844b4 100644 --- a/system/core/Common.php +++ b/system/core/Common.php @@ -741,14 +741,14 @@ if ( ! function_exists('html_escape')) */ function html_escape($var, $double_encode = TRUE) { + // If empty, skip escaping + if (empty($var)) + { + return $var; + } + if (is_array($var)) { - // If empty array, skip escaping - if ( empty($var) ) - { - return $var; - } - return array_map('html_escape', $var, array_fill(0, count($var), $double_encode)); } -- cgit v1.2.3-24-g4f1b From 362ff3ae4b6ce363c9cb07de682180bc447c8e28 Mon Sep 17 00:00:00 2001 From: Joshua Logsdon Date: Wed, 25 Mar 2015 12:08:19 -0400 Subject: Remove comment Signed-off-by: Joshua Logsdon --- system/core/Common.php | 1 - 1 file changed, 1 deletion(-) (limited to 'system') diff --git a/system/core/Common.php b/system/core/Common.php index 2b1e844b4..f28272b5b 100644 --- a/system/core/Common.php +++ b/system/core/Common.php @@ -741,7 +741,6 @@ if ( ! function_exists('html_escape')) */ function html_escape($var, $double_encode = TRUE) { - // If empty, skip escaping if (empty($var)) { return $var; -- cgit v1.2.3-24-g4f1b