From 40466ccb02ea6fa4e2d06906c87746d22e0d3065 Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Mon, 12 Apr 2010 05:00:40 +0000 Subject: [PATCH] BUG FIX: The 5.1 replacement array_fill_keys function now made available to the cron jobs (from r97300) git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@102441 467b73ca-7a2a-4603-9d3b-597d59a354a9 --- core/Core.php | 14 ++++++++++++++ main.php | 13 ------------- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/core/Core.php b/core/Core.php index 6dcefca71..b9dd3d95b 100755 --- a/core/Core.php +++ b/core/Core.php @@ -24,6 +24,20 @@ if(defined('E_DEPRECATED')) error_reporting(E_ALL ^ E_DEPRECATED); else error_reporting(E_ALL); +/* + * This is for versions of PHP prior to version 5.2 + * Creating this here will allow both web requests and cron jobs to inherit it. + */ +if (!function_exists('array_fill_keys')) { + 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)); + } +} + /** * Include _ss_environment.php files */ diff --git a/main.php b/main.php index e6d9b9d80..a493e4551 100644 --- a/main.php +++ b/main.php @@ -65,19 +65,6 @@ if (function_exists('mb_http_output')) { mb_internal_encoding('UTF-8'); } -/* - * This is for versions of PHP prior to version 5.2 - */ -if (!function_exists('array_fill_keys')) { - 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(); // IIS will sometimes generate this.