[ Index ]

PHP Cross Reference of Unnamed Project

title

Body

[close]

/includes/ -> error_collector.php (source)

   1  <?php
   2  /**
   3  *
   4  * @package phpBB
   5  * @version $Id$
   6  * @copyright (c) 2011 phpBB Group
   7  * @license http://opensource.org/licenses/gpl-license.php GNU Public License
   8  *
   9  */
  10  
  11  /**
  12  * @ignore
  13  */
  14  if (!defined('IN_PHPBB'))
  15  {
  16      exit;
  17  }
  18  
  19  class phpbb_error_collector
  20  {
  21      var $errors;
  22  
  23  	function phpbb_error_collector()
  24      {
  25          $this->errors = array();
  26      }
  27  
  28  	function install()
  29      {
  30          set_error_handler(array(&$this, 'error_handler'));
  31      }
  32  
  33  	function uninstall()
  34      {
  35          restore_error_handler();
  36      }
  37  
  38  	function error_handler($errno, $msg_text, $errfile, $errline)
  39      {
  40          $this->errors[] = array($errno, $msg_text, $errfile, $errline);
  41      }
  42  
  43  	function format_errors()
  44      {
  45          $text = '';
  46          foreach ($this->errors as $error)
  47          {
  48              if (!empty($text))
  49              {
  50                  $text .= "<br />\n";
  51              }
  52  
  53              list($errno, $msg_text, $errfile, $errline) = $error;
  54  
  55              // Prevent leakage of local path to phpBB install
  56              $errfile = phpbb_filter_root_path($errfile);
  57  
  58              $text .= "Errno $errno: $msg_text at $errfile line $errline";
  59          }
  60  
  61          return $text;
  62      }
  63  }


Generated: Wed Oct 2 15:03:47 2013 Cross-referenced by PHPXref 0.7.1