From 729d8fddea94741e8339bf16ab128599db7a241a Mon Sep 17 00:00:00 2001 From: nate Date: Fri, 31 Jul 2009 11:48:30 -0400 Subject: [PATCH] Applying PHP 5.3 compatibility patch from Mark Story. Please update your config/core.php, webroot/index.php and webroot/test.php accordingly. --- app/config/core.php | 5 +++++ app/webroot/index.php | 7 +++++++ app/webroot/test.php | 9 ++++++++- cake/bootstrap.php | 3 +++ cake/console/libs/templates/skel/config/core.php | 5 +++++ cake/console/libs/templates/skel/webroot/index.php | 7 +++++++ cake/console/libs/templates/skel/webroot/test.php | 9 ++++++++- cake/libs/configure.php | 2 +- cake/libs/debugger.php | 2 +- 9 files changed, 45 insertions(+), 4 deletions(-) diff --git a/app/config/core.php b/app/config/core.php index 01b8d563d..28ee3f5d6 100644 --- a/app/config/core.php +++ b/app/config/core.php @@ -184,6 +184,11 @@ */ Configure::write('Acl.classname', 'DbAcl'); Configure::write('Acl.database', 'default'); +/** + * If you are on PHP 5.3 uncomment this line and correct your server timezone + * to fix the date & time related errors. + */ + //date_default_timezone_set('UTC'); /** * * Cache Engine Configuration diff --git a/app/webroot/index.php b/app/webroot/index.php index 526cecba3..083812fdd 100644 --- a/app/webroot/index.php +++ b/app/webroot/index.php @@ -52,6 +52,13 @@ if (!defined('CAKE_CORE_INCLUDE_PATH')) { define('CAKE_CORE_INCLUDE_PATH', ROOT); } +/** + * PHP 5.3 raises many notices in bootstrap. + */ + if (!defined('E_DEPRECATED')) { + define('E_DEPRECATED', 8192); + } + error_reporting(E_ALL & ~E_DEPRECATED); /** * Editing below this line should NOT be necessary. diff --git a/app/webroot/test.php b/app/webroot/test.php index 1e9a044ac..725469d93 100644 --- a/app/webroot/test.php +++ b/app/webroot/test.php @@ -24,7 +24,14 @@ * @lastmodified $Date$ * @license http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License */ -error_reporting(E_ALL); +/** + * PHP 5.3 raises many notices in bootstrap. + */ +if (!defined('E_DEPRECATED')) { + define('E_DEPRECATED', 8192); +} +error_reporting(E_ALL & ~E_DEPRECATED); + set_time_limit(0); ini_set('memory_limit','128M'); ini_set('display_errors', 1); diff --git a/cake/bootstrap.php b/cake/bootstrap.php index c50974478..88d1526d7 100644 --- a/cake/bootstrap.php +++ b/cake/bootstrap.php @@ -22,6 +22,9 @@ if (!defined('PHP5')) { define('PHP5', (PHP_VERSION >= 5)); } +if (!defined('E_DEPRECATED')) { + define('PHP5', (PHP_VERSION >= 5)); +} require CORE_PATH . 'cake' . DS . 'basics.php'; $TIME_START = getMicrotime(); require CORE_PATH . 'cake' . DS . 'config' . DS . 'paths.php'; diff --git a/cake/console/libs/templates/skel/config/core.php b/cake/console/libs/templates/skel/config/core.php index dfcba1ea5..fbd02e74a 100644 --- a/cake/console/libs/templates/skel/config/core.php +++ b/cake/console/libs/templates/skel/config/core.php @@ -170,6 +170,11 @@ */ Configure::write('Acl.classname', 'DbAcl'); Configure::write('Acl.database', 'default'); +/** + * If you are on PHP 5.3 uncomment this line and correct your server timezone + * to fix the date & time related errors. + */ + //date_default_timezone_set('UTC'); /** * * Cache Engine Configuration diff --git a/cake/console/libs/templates/skel/webroot/index.php b/cake/console/libs/templates/skel/webroot/index.php index 59484d983..efdc5b680 100644 --- a/cake/console/libs/templates/skel/webroot/index.php +++ b/cake/console/libs/templates/skel/webroot/index.php @@ -57,6 +57,13 @@ if (!defined('CAKE_CORE_INCLUDE_PATH')) { define('CAKE_CORE_INCLUDE_PATH', ROOT); } +/** + * PHP 5.3 raises many notices in bootstrap. + */ + if (!defined('E_DEPRECATED')) { + define('E_DEPRECATED', 8192); + } + error_reporting(E_ALL & ~E_DEPRECATED); /** * Editing below this line should not be necessary. diff --git a/cake/console/libs/templates/skel/webroot/test.php b/cake/console/libs/templates/skel/webroot/test.php index 1e9a044ac..725469d93 100644 --- a/cake/console/libs/templates/skel/webroot/test.php +++ b/cake/console/libs/templates/skel/webroot/test.php @@ -24,7 +24,14 @@ * @lastmodified $Date$ * @license http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License */ -error_reporting(E_ALL); +/** + * PHP 5.3 raises many notices in bootstrap. + */ +if (!defined('E_DEPRECATED')) { + define('E_DEPRECATED', 8192); +} +error_reporting(E_ALL & ~E_DEPRECATED); + set_time_limit(0); ini_set('memory_limit','128M'); ini_set('display_errors', 1); diff --git a/cake/libs/configure.php b/cake/libs/configure.php index f73499d22..7fc6d3492 100644 --- a/cake/libs/configure.php +++ b/cake/libs/configure.php @@ -110,7 +110,7 @@ class Configure extends Object { if (isset($config['debug'])) { if ($_this->debug) { - error_reporting(E_ALL); + error_reporting(E_ALL & ~E_DEPRECATED); if (function_exists('ini_set')) { ini_set('display_errors', 1); diff --git a/cake/libs/debugger.php b/cake/libs/debugger.php index bab67ae80..6c11e2768 100644 --- a/cake/libs/debugger.php +++ b/cake/libs/debugger.php @@ -252,7 +252,7 @@ class Debugger extends Object { * @access public */ function handleError($code, $description, $file = null, $line = null, $context = null) { - if (error_reporting() == 0 || $code === 2048) { + if (error_reporting() == 0 || $code === 2048 || $code === 8192) { return; }