Adding extra charsets for ActionMailer unit tests, if you're looking to parse incomin...
[akelos.git] / lib / AkErrorHandler.php
blobdd33adf2ca94096098962946b046129c7a4dd169
1 <?php
2 /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
4 // +----------------------------------------------------------------------+
5 // | Akelos Framework - http://www.akelos.org |
6 // +----------------------------------------------------------------------+
7 // | Copyright (c) 2002-2006, Akelos Media, S.L. & Bermi Ferrer Martinez |
8 // | Released under the GNU Lesser General Public License, see LICENSE.txt|
9 // +----------------------------------------------------------------------+
11 /**
12 * This class will handle errors on production mode
13 * @todo Connect with Loggers in order to provide a strong error reporting
14 * system on production mode
16 * @package ActiveSupport
17 * @subpackage Reporting
18 * @author Bermi Ferrer <bermi a.t akelos c.om>
19 * @copyright Copyright (c) 2002-2006, Akelos Media, S.L. http://www.akelos.org
20 * @license GNU Lesser General Public License <http://www.gnu.org/copyleft/lesser.html>
22 class AkErrorHandler {
24 /**
25 * Constructor
26 * @access public
28 function AkErrorHandler() {
29 return false;
32 /**
33 * @param int $errNo
34 * @param string $errMsg
35 * @param string $file
36 * @param int $line
37 * @return void
38 * @access public
40 function raiseError($errNo, $errMsg, $file, $line)
42 if (! ($errNo & error_reporting())) {
43 return;
45 while (ob_get_level()) {
46 ob_end_clean();
50 //echo nl2br(print_r(get_defined_vars(),true)).'<hr />';
51 if (! ($errNo & error_reporting())) {
52 return;
54 while (ob_get_level()) {
55 ob_end_clean();
58 $errType = array (
59 1 => "Php Error",
60 2 => "Php Warning",
61 4 => "Parsing Error",
62 8 => "Php Notice",
63 16 => "Core Error",
64 32 => "Core Warning",
65 64 => "Compile Error",
66 128 => "Compile Warning",
67 256 => "Php User Error",
68 512 => "Php User Warning",
69 1024 => "Php User Notice"
73 if(substr($errMsg,0,9) == 'database|'){
74 die('Database connection error');
75 header('Location: '.AK_URL.Ak::tourl(array('controller'=>'error','action'=>'database')));
76 exit;
79 $info = array();
81 if (($errNo & E_USER_ERROR) && is_array($arr = @unserialize($errMsg))) {
82 foreach ($arr as $k => $v) {
83 $info[$k] = $v;