[ Index ]

PHP Cross Reference of Akelos Framework

title

Body

[close]

/ -> AkErrorHandler.php (source)

   1  <?php
   2  /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
   3  
   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  // +----------------------------------------------------------------------+
  10  
  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
  15   * 
  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>
  21   */
  22  class AkErrorHandler {
  23  
  24      /**
  25      * Constructor
  26      * @access public
  27      */
  28      function AkErrorHandler() {
  29          return false;
  30      }
  31  
  32      /**
  33      * @param int $errNo
  34      * @param string $errMsg
  35      * @param string $file
  36      * @param int $line
  37      * @return void
  38      * @access public
  39      */
  40      function raiseError($errNo, $errMsg, $file, $line) 
  41      {
  42              if (! ($errNo & error_reporting())) {
  43                  return;
  44              }
  45              while (ob_get_level()) {
  46                  ob_end_clean();
  47              }
  48  
  49  
  50          //echo nl2br(print_r(get_defined_vars(),true)).'<hr />';
  51          if (! ($errNo & error_reporting())) {
  52              return;
  53          }
  54          while (ob_get_level()) {
  55              ob_end_clean();
  56          }
  57          
  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"
  70          );
  71  
  72          
  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;
  77          }
  78              
  79          $info = array();
  80  
  81          if (($errNo & E_USER_ERROR) && is_array($arr = @unserialize($errMsg))) {
  82              foreach ($arr as $k => $v) {
  83                  $info[$k] = $v;
  84              }
  85          }
  86      }
  87  }
  88  
  89  ?>


Generated: Mon Oct 27 12:43:49 2008 Cross-referenced by PHPXref 0.6