From e0486dc4a726babd6a15300b13377cbc9e0f639f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 3 Jan 2007 00:07:57 +0000 Subject: [PATCH] =?UTF-8?q?Ajout=20code=20pour=20compatibilit=E9=20PHP=205?= =?UTF-8?q?.2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- htdocs/main.inc.php | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 57dafa7fdb5..506df178965 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -682,4 +682,27 @@ function llxFooter($foot='',$limitIEbug=1) print "\n"; print "\n"; } + + +/**************************************************************** +* Error handler for PHP 5.2 +* This make Dolibarr working in PHP 5.2+ when some code do print "$object" and $object is an object. +*/ +/**************************************************************** +function compatibilityErrorHandler($errno, $errstr, $errfile, $errline) +{ + switch ($errno) { + case E_RECOVERABLE_ERROR: + break; + default: + echo "Unknown error type: [$errno] $errstr
\n"; + break; + } +} +if (defined("E_RECOVERABLE_ERROR")) // set to the user defined error handler +{ + $old_error_handler = set_error_handler("compatibilityErrorHandler",E_RECOVERABLE_ERROR); +} +****************************************************************/ + ?>