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
This commit is contained in:
Geoff Munn 2010-01-15 01:43:32 +00:00 committed by Sam Minnee
parent e77964a5b9
commit 30892c1325

View File

@ -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();