From: cajus Date: Fri, 24 Jun 2005 05:58:21 +0000 (+0000) Subject: Moved error handler to php_setup in order to get an earlier registration X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=6479edcb1fa66f23345848e9a7cb1a684be454df;p=gosa.git Moved error handler to php_setup in order to get an earlier registration git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@818 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/include/functions.inc b/include/functions.inc index 308376d58..86783d986 100644 --- a/include/functions.inc +++ b/include/functions.inc @@ -1516,118 +1516,6 @@ function get_gosa_version() } } -function gosaRaiseError($errno, $errstr, $errfile, $errline) -{ - global $error_collector; - - /* Return if error reporting is set to zero */ - if (error_reporting() == 0){ - return; - } - - /* Workaround for buggy imap_open error outputs */ - if (preg_match('/imap_open/', $errstr)){ - return; - } - - /* FIXME: Workaround for PHP5 error message flooding. The new OOM - code want's us to use public/protected/private instead of flat - var declarations. For now I can't workaround this - let's ignore - the messages till the next major release which may drop support - for PHP4. */ - if (preg_match('/var: Deprecated./', $errstr)){ - return; - } - - /* FIXME: Same as above. Compatibility does error flooding.*/ - if (preg_match('/zend.ze1_compatibility_mode/', $errstr)){ - return; - } - - /* Hide ldap size limit messages */ - if (preg_match('/ldap_error/', $errstr)){ - if (preg_match('/sizelimit/', $errstr)){ - return; - } - } - - /* Create header as needed */ - if ($error_collector == ""){ - if ($_SESSION['js']==FALSE){ - $error_collector= "
"; - } else { - $error_collector= "
\"\" "._("Generating this page caused the PHP interpreter to raise some errors!")."
"; - flush(); - exit; - } -} - - -function dummy_error_handler() -{ -} function rmdirRecursive($path, $followLinks=false) { $dir= opendir($path); diff --git a/include/php_setup.inc b/include/php_setup.inc index 7979c6368..a27f032dd 100644 --- a/include/php_setup.inc +++ b/include/php_setup.inc @@ -18,11 +18,129 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +function gosaRaiseError($errno, $errstr, $errfile, $errline) +{ + global $error_collector; + + /* Return if error reporting is set to zero */ + if (error_reporting() == 0){ + return; + } + + /* Workaround for buggy imap_open error outputs */ + if (preg_match('/imap_open/', $errstr)){ + return; + } + + /* FIXME: Workaround for PHP5 error message flooding. The new OOM + code want's us to use public/protected/private instead of flat + var declarations. For now I can't workaround this - let's ignore + the messages till the next major release which may drop support + for PHP4. */ + if (preg_match('/var: Deprecated./', $errstr)){ + return; + } + + /* FIXME: Same as above. Compatibility does error flooding.*/ + if (preg_match('/zend.ze1_compatibility_mode/', $errstr)){ + return; + } + + /* Hide ldap size limit messages */ + if (preg_match('/ldap_error/', $errstr)){ + if (preg_match('/sizelimit/', $errstr)){ + return; + } + } + + /* Create header as needed */ + if ($error_collector == ""){ + if ($_SESSION['js']==FALSE){ + $error_collector= "
"; + } else { + $error_collector= "
\"\" "._("Generating this page caused the PHP interpreter to raise some errors!")."
"; + flush(); + exit; + } +} + + +function dummy_error_handler() +{ +} + + /* Get base dir for reference */ $BASE_DIR= dirname(dirname(__FILE__)); $ROOT_DIR= $BASE_DIR."/html"; error_reporting (E_ALL); +/* Register error handler */ +$error_collector= ""; +set_error_handler('gosaRaiseError'); + $variables_order= "ES"; ini_set("register_globals",0); ini_set("track_vars",1);