BUGFIX: Check for an empty list of keys before attempting to create an array with them (from r96997)

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@102416 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Ingo Schommer 2010-04-12 03:30:19 +00:00
parent 474a6a9931
commit 04857b811f

View File

@ -69,9 +69,13 @@ if (function_exists('mb_http_output')) {
* This is for versions of PHP prior to version 5.2 * This is for versions of PHP prior to version 5.2
*/ */
if (!function_exists('array_fill_keys')) { if (!function_exists('array_fill_keys')) {
function array_fill_keys($keys,$value) { function array_fill_keys($keys,$value) {
return array_combine($keys,array_fill(0,count($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(); Session::start();