Definition at line 830 of file PEAR.php.
◆ __construct()
PEAR_Error::__construct |
( |
|
$message = 'unknown error' , |
|
|
|
$code = null , |
|
|
|
$mode = null , |
|
|
|
$options = null , |
|
|
|
$userinfo = null |
|
) |
| |
PEAR_Error constructor.
- Parameters
-
string | $message | message |
int | $code | (optional) error code |
int | $mode | (optional) error mode, one of: PEAR_ERROR_RETURN, PEAR_ERROR_PRINT, PEAR_ERROR_DIE, PEAR_ERROR_TRIGGER, PEAR_ERROR_CALLBACK or PEAR_ERROR_EXCEPTION |
mixed | $options | (optional) error level, OR in the case of PEAR_ERROR_CALLBACK, the callback function or object/method tuple. |
string | $userinfo | (optional) additional user/debug info |
public
Definition at line 865 of file PEAR.php.
References $code, $format, $message, $options, PEAR\getStaticProperty(), PEAR_ERROR_CALLBACK, PEAR_ERROR_DIE, PEAR_ERROR_EXCEPTION, PEAR_ERROR_PRINT, PEAR_ERROR_RETURN, and PEAR_ERROR_TRIGGER.
868 if (
$mode === null) {
876 $this->backtrace = debug_backtrace();
877 if (isset($this->backtrace[0]) && isset($this->backtrace[0][
'object'])) {
878 unset($this->backtrace[0][
'object']);
882 $this->level = E_USER_NOTICE;
889 $this->callback = null;
900 trigger_error($this->
getMessage(), $this->level);
906 if (substr($msg, -1) !=
"\n") {
914 if ($this->mode & PEAR_ERROR_CALLBACK) {
915 if (is_callable($this->callback)) {
916 call_user_func($this->callback, $this);
920 trigger_error(
"PEAR_ERROR_EXCEPTION is obsolete, use class PEAR_Exception for exceptions", E_USER_WARNING);
921 $e =
new Exception($this->message, $this->code);
throw($e);
static & getStaticProperty($class, $var)
If you have a class that's mostly/entirely static, and you need static properties, you can use this method to simulate them.
const PEAR_ERROR_CALLBACK
getMessage()
Get the error message from an error object.
const PEAR_ERROR_EXCEPTION
WARNING: obsolete.
const PEAR_ERROR_RETURN
#+ ERROR constants
if(!isset($_REQUEST['ReturnTo'])) if(!isset($_REQUEST['AuthId'])) $options
◆ __toString()
PEAR_Error::__toString |
( |
| ) |
|
Definition at line 1059 of file PEAR.php.
getMessage()
Get the error message from an error object.
◆ addUserInfo()
PEAR_Error::addUserInfo |
( |
|
$info | ) |
|
Definition at line 1048 of file PEAR.php.
References $info.
1050 if (empty($this->userinfo)) {
1051 $this->userinfo =
$info;
1053 $this->userinfo .=
" ** $info";
◆ getBacktrace()
PEAR_Error::getBacktrace |
( |
|
$frame = null | ) |
|
Get the call backtrace from where the error was generated.
Supported with PHP 4.3.0 or newer.
- Parameters
-
int | $frame | (optional) what frame to fetch |
- Returns
- array Backtrace, or NULL if not available. public
Definition at line 1034 of file PEAR.php.
References defined.
1036 if (
defined(
'PEAR_IGNORE_BACKTRACE')) {
1039 if ($frame === null) {
1042 return $this->backtrace[$frame];
defined( 'APPLICATION_ENV')||define( 'APPLICATION_ENV'
◆ getCallback()
PEAR_Error::getCallback |
( |
| ) |
|
Get the callback function/method from an error object.
- Returns
- mixed callback function or object/method array public
Definition at line 947 of file PEAR.php.
948 return $this->callback;
◆ getCode()
Get error code from an error object.
- Returns
- int error code public
Definition at line 976 of file PEAR.php.
References $code.
◆ getDebugInfo()
PEAR_Error::getDebugInfo |
( |
| ) |
|
Get additional debug information supplied by the application.
- Returns
- string debug information public
Definition at line 1018 of file PEAR.php.
getUserInfo()
Get additional user-supplied information.
◆ getMessage()
PEAR_Error::getMessage |
( |
| ) |
|
Get the error message from an error object.
- Returns
- string full error message public
Definition at line 961 of file PEAR.php.
963 return ($this->error_message_prefix . $this->message);
◆ getMode()
Get the error mode from an error object.
- Returns
- int error mode public
Definition at line 934 of file PEAR.php.
◆ getType()
Get the name of this error/exception.
- Returns
- string error/exception name (type) public
Definition at line 990 of file PEAR.php.
992 return get_class($this);
◆ getUserInfo()
PEAR_Error::getUserInfo |
( |
| ) |
|
Get additional user-supplied information.
- Returns
- string user-supplied information public
Definition at line 1004 of file PEAR.php.
◆ toString()
Make a string representation of this object.
- Returns
- string a string with an object summary public
Definition at line 1072 of file PEAR.php.
References array, PEAR_ERROR_CALLBACK, PEAR_ERROR_DIE, PEAR_ERROR_PRINT, PEAR_ERROR_RETURN, and PEAR_ERROR_TRIGGER.
1074 $levels =
array(E_USER_NOTICE =>
'notice',
1075 E_USER_WARNING =>
'warning',
1076 E_USER_ERROR =>
'error');
1078 if (is_array($this->callback)) {
1079 $callback = (is_object($this->callback[0]) ?
1080 strtolower(get_class($this->callback[0])) :
1081 $this->callback[0]) .
'::' .
1084 $callback = $this->callback;
1086 return sprintf(
'[%s: message="%s" code=%d mode=callback '.
1087 'callback=%s prefix="%s" info="%s"]',
1088 strtolower(get_class($this)), $this->message, $this->code,
1089 $callback, $this->error_message_prefix,
1096 $modes[] =
'trigger';
1102 $modes[] =
'return';
1104 return sprintf(
'[%s: message="%s" code=%d mode=%s level=%s '.
1105 'prefix="%s" info="%s"]',
1106 strtolower(get_class($this)), $this->message, $this->code,
1107 implode(
"|", $modes), $levels[$this->level],
1108 $this->error_message_prefix,
const PEAR_ERROR_CALLBACK
const PEAR_ERROR_RETURN
#+ ERROR constants
Create styles array
The data for the language used.
◆ $backtrace
PEAR_Error::$backtrace = null |
◆ $code
◆ $error_message_prefix
PEAR_Error::$error_message_prefix = '' |
◆ $level
PEAR_Error::$level = E_USER_NOTICE |
◆ $message
PEAR_Error::$message = '' |
◆ $mode
◆ $userinfo
PEAR_Error::$userinfo = '' |
The documentation for this class was generated from the following file: