From 30892c13253c749549d9ee883fa5cfe7e2f208bb Mon Sep 17 00:00:00 2001 From: Geoff Munn Date: Fri, 15 Jan 2010 01:43:32 +0000 Subject: [PATCH] BUGFIX: Check for an empty list of keys before attempting to create an array with them git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.4@96997 467b73ca-7a2a-4603-9d3b-597d59a354a9 --- main.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/main.php b/main.php index 860d374e7..e6d9b9d80 100644 --- a/main.php +++ b/main.php @@ -69,9 +69,13 @@ if (function_exists('mb_http_output')) { * This is for versions of PHP prior to version 5.2 */ if (!function_exists('array_fill_keys')) { - function array_fill_keys($keys,$value) { - return array_combine($keys,array_fill(0,count($keys),$value)); - } + function array_fill_keys($keys,$value) { + //Sometimes we get passed an empty array, and if that's the case, you'll get an error message + if(sizeof($keys)==0) + return Array(); + else + return array_combine($keys,array_fill(0,count($keys),$value)); + } } Session::start();