Source code for file /pattemplate/patError.php
Documentation is available at patError.php
* patError error object used by the patFormsError manager as error messages
* container for precise error management.
* $Id: patError.php 47 2005-09-15 02:55:27Z rhuk $
* patError error object used by the patFormsError manager as error messages
* container for precise error management.
* $Id: patError.php 47 2005-09-15 02:55:27Z rhuk $
* @link http://www.php-tools.net
* stores the error level for this error
* stores the code of the error
* stores the error message - this is the message that can also be shown the
* additional info that is relevant for the developer of the script (e.g. if
* a database connect fails, the dsn used) and that the end-user should not
* stores the filename of the file the error occurred in.
* stores the line number the error occurred in.
* stores the name of the method the error occurred in
* stores the name of the class (if any) the error occurred in.
* stores the type of error, as it is listed in the error backtrace
* stores the arguments the method that the error occurred in had received.
* stores the complete debug backtrace (if your PHP version has the
* debug_backtrace function)
* constructor, wrapper for the upcoming PHP5 constructors for upward
* @param int $level The error level (use the PHP constants E_ALL, E_NOTICE etc.).
* @param string $code The error code from the application
* @param string $msg The error message
* @param string $info Optional: The additional error information.
function patError( $level, $code, $msg, $info =
null )
* constructor - used to set up the error with all needed error details.
* @param int $level The error level (use the PHP constants E_ALL, E_NOTICE etc.).
* @param string $code The error code from the application
* @param string $msg The error message
* @param string $info Optional: The additional error information.
* @todo all calls to patErrorManager::raise* should not be included in backtrace
function __construct( $level, $code, $msg, $info =
null )
static $raise =
array( 'raise',
if( function_exists( 'debug_backtrace' ) )
$this->backtrace =
debug_backtrace();
for( $i =
count( $this->backtrace ) -
1; $i >=
0; --
$i )
if( in_array( $this->backtrace[$i]['function'], $raise ) )
if( isset
( $this->backtrace[$i]['file'] ) )
$this->file =
$this->backtrace[$i]['file'];
if( isset
( $this->backtrace[$i]['line'] ) )
$this->line =
$this->backtrace[$i]['line'];
if( isset
( $this->backtrace[$i]['class'] ) )
$this->class =
$this->backtrace[$i]['class'];
if( isset
( $this->backtrace[$i]['function'] ) )
$this->function =
$this->backtrace[$i]['function'];
if( isset
( $this->backtrace[$i]['type'] ) )
$this->type =
$this->backtrace[$i]['type'];
if( isset
( $this->backtrace[$i]['args'] ) )
$this->args =
$this->backtrace[$i]['args'];
* returns the error level of the error - corresponds to the PHP
* error levels (E_ALL, E_NOTICE...)
* @return int $level The error level
* retrieves the error message
* @return string $msg The stored error message
* retrieves the additional error information (information usually
* only relevant for developers)
* @return mixed $info The additional information
* @return string|integer error code (may be a string or an integer)
* This is only possible, if debug_backtrace() is available.
* @return array backtrace
if ($formatted &&
is_array( $this->backtrace )) {
if (!eregi( 'patErrorManager.php', $back['file'])) {
$result .=
'<br />'.
$back['file'].
':'.
$back['line'];
* get the filename in which the error occured
* This is only possible, if debug_backtrace() is available.
* @return string filename
* get the line number in which the error occured
* This is only possible, if debug_backtrace() is available.
* @return integer line number